I have to do an auto validate stuff, so I must put .blur() and .focus() event handlers on input fields which have the ‘checkMe’ prefix in their class attribute, so they will look alike ‘class=”checkMe-required”‘, ‘class=”checkMe-mustBeInt”‘, ‘class=”checkMe-mustBeDate”‘ and so on. How to do this? This $('.checkMe-*').focus(function() { aint work…
I have to do an auto validate stuff, so I must put .blur() and
Share
Use the “starts-with” selector:
However, performance-wise, it would probably be better to have a
checkMeclass and add the other part as a second class:Then you can use the normal class selector: