views:

52

answers:

1

Hi i am having the follow code

<div id="container">
    <div class="element NOTME"></div>
    <div class="element"></div>
    <div class="element"></div>
    <div class="element"></div>
</div>

the code below select the inputs inside container with class element

$("#container .element input[name^='myname']").each

How can i rewrite the above code (the selector actually) that will exclude when has class NOTME

Thanks

+1  A: 

You can add the qualifier :not(.NOTME):

$('#container .element:not(.NOTME) input[name^=myname]').each( ... )

The :not() can reference any selector expression, of course.

Pointy
Sorry i was using .element:not(".NOTME"). Thanks
ntan