Hello i have this following function:
... var model = $("#carModel");
.... model.change(validModel);
function validModel(){
if(model.val() == 0){
model.addClass("errorJS");
return false;
}else{
model.removeClass("errorJS");
return true;
}
}
I am getting carmodel id from a select box generated after an AJAX call. I can get its value in the Firebug console, but the function doest not execute. Even tough i use model.livequery(validModel);
// The errorJS class puts a red border arround a element, if the function returns false
Among other problems,
modelmeans nothing inside the function context. Also, it makes no sense to callchange(validModel)with this function, as it only returns a true/false value. You’ll need to do something like:and change the definition of
validModelto