Here is a start.


$('input:text:enabled, select:enabled').each(function() {
    var curFieldID = this.id;
    var orgnlFieldID = curFieldID + '_orig';
    if( $('#' + orgnlFieldID).val() != $('#' + curFieldID).val()) {
            $(this).addClass('highlightchange');
    }
});

It would also help if you were able to give the initial selector a context. For example, if all the enabled inputs and selects were within an element with a particular id, you could do:

$('#myid').find('input:text:enabled, select:enabled') ...

Hope that helps.

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Apr 24, 2008, at 5:31 AM, phipps_73 wrote:


Hi,

I am trying to get a field highlighter working. I have a 2 column
layout with a form in each. The form on the left is the 'original'
data and the form on the right is newly updated. I would like to look
at each form field and compare their values and if different add a
class to highlight the change. I have the following code:
http://rafb.net/p/UXZHd938.html

The forms are quite large and this code basically kills the browser
and I get a Slow script warning. Does anyone know if there is a way to
speed this up or make it more efficient or should I handle it server
side?

Cheers

Dave

Reply via email to