Following is my HTML :
<div id="formdata">
<div id="to_select">
<input type='hidden' name='to_be_selected' value='a' />
<input type='hidden' name='also_to_be_selected' value='a' />
</div>
<input type='hidden' name='to_be_selected_too' value='a' />
<div id="not_to_select">
<input type='hidden' name='not_to_select' value='not selected'/>
</div>
</div>
How do I select only elements which are not in div#not_to_select
Following is what I have tried :
$("#formdata div:not(#not_to_select)").find('input')
$("#formdata").not("div#not_to_select").find('input,select,textarea')
$("#formdata").find('input,select,textarea').filter(function(){
return $(this).parent().is(":not(#not_to_select)");
})