I have a HTML form containing 10 input elements and I want to call a function on keypress on each of those input elements except 2 of those
$(":input").live("keypress", function(e){
// something...
});
The above selector will work for all input elements. But I want to exclude 2 of my input elements (By id or By class) from the above code. How shall I do it? Is there an exclude/ not feature in css selector?
The other way of doing it can be by appending the id's of the input elements to be included by something like "keypress_" and then using
$("[id^=keypress_]").live("keypress", function(e){
// something...
});
But I donot want to change the HTML ids. Can this be done by css selector?
:inputis not a CSS selector.