Reputation: 10696
To select input ending with -top
I can sue the following:
$("input[class$='-top'],input[class*='-top ']")
But, how to check if this end with -top
?
$('Input').keyup( function(){
// How to check if $(this).prop('class') end with "-top"
});
How to check if $(this).prop('class') end with "-top"
Any suggestions much appreciated.
Upvotes: 1
Views: 1293
Reputation: 413717
You're looking for .is()
:
if ($(this).is('[class*=-top]')) { ... }
edit — substitute in the selector of your choice of course ...
Upvotes: 7