HTML
<input type="text" id="trainingFee" name ="training Fee" class="number error" value="" onblur="callMe()">
jQuery
function callMe(){
if($this.id).hasClass('error')){
alert("has error class");
}
}
but this is not working. What am I doing wrong?
You are trying to access the current id of the element using the this context..
You need to pass it to the function in order to do it
onblur=”callMe(this)”
Otherwise you can try this approach
FIDDLE