Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery .not(), multiple excludes with id

I got this small piece of code to reset a form:

$("#reset").click(function() {
    $(':input','#fundingpossibility')
    .not(':button, :submit, :reset, :hidden')
    .val('');
});

I'd like to add an input field with, let's say, an id of #test to the .not() selector. I've tried various things, but can't make it to work. Does anyone have any ideas?

like image 264
Alex Berg Avatar asked Dec 28 '10 10:12

Alex Berg


1 Answers

Just add another comma (multiple selector), for example:

$("#reset").click(function() {
  $(':input','#fundingpossibility')
  .not(':button, :submit, :reset, :hidden, #test')
  .val('');
});
like image 130
Nick Craver Avatar answered Oct 31 '22 07:10

Nick Craver