Alex Rivera | Logout

jQuery .not(), multiple excludes with id

Asked 2010-12-28T10:04:27.553
18

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?

Edit
Report

1 Answer

39

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

$("#reset").click(function() {
  $(':input','#fundingpossibility')
  .not(':button, :submit, :reset, :hidden, #test')
  .val('');
});
answered 2010-12-28T10:05:56.337

Your Answer