I was wondering how to press Enter but NOT when a particular class exists on the element being targeted ?
jQuery("#input").keypress(function (e) {
if (e.keyCode == 13 && jQuery('.classTest').not(this)) {
//any item selected with enter EXCEPT which has .classTest
}
});
?
P.S. use
.input! ID’s are for ONE element only.WORKING DEMO
Code used:
!( $(this).hasClass('classTest') )! = not
jQuery API .hasClass()