0

Trying to validate if a "Tool" field in a sharepoint new item form equals one of 2 strings when user causes blur event. If it is either "abc" or "zzz", then I need to popup and alert. Not sure what I'm missing here:

<script type="text/javascript"> 
$(document).ready(function() { 
 $( "#Tool" ).blur(){

if($("#Tool").val() == "abc" || "zzz") {
   alert('Warning...');
}
}

}); 
</script> 
0

Fixed by:

$(document).ready(function() {

  $("#Tool").blur(function(){

    if($("#Tool").val() == "abc" || $("#Tool").val() == "zzz"){
        alert('warning');
    }

});
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.