$('select').change(function() {
//important stuff
});
Before doing important stuff I want to verify the selector in question by its ID. All of the IDs I want to affect end with _stat. How would you do this with a regular expression (or something else) in JQuery?
$('select').change(function() {
if ($("select[id*='_stat']")) { //<~ this aint work
//important stuff
}
});
You can do this with
if ($(this).is("select[id$='_stat']")), but it would surely be better to attach the event handler to these elements only in the first place — then you wouldn’t have to check at all: