Search code examples
javascriptjquerydhtml

how to exclude an element during the binding event


when iterating over a collection of form elements as shown below is it possible to ignore an element? I've noticed for a certain scenario the form produces a unique text field which is causing an issue. im using jquery 1.3.2

http://jsfiddle.net/ewWaF/

if you remove the newfield1 and newfield2 it works from the link above.

many thanks,


Solution

  • Since those fields are display:none you can filter by using the .not() and the :hidden selector

    $('.PassengerWrapper input[type=text], .PassengerWrapper select').not(":hidden")
    

    Here's an update to your fiddle

    http://jsfiddle.net/ewWaF/2/