I have a code that prevents a modal from opening when there is an error but the problem is when i open it once the next time it opens even if there is an error so the question is how to stop it from opening on the next time when there is an error again?
Here is the code:
jQuery(".link").click(function(a){
var newVal2 = jQuery("#appID").val();
if(error === '1' || defaultVal2 === newVal2){
alert("Please fill in a valid App ID.");
a.preventDefault();
}
else {
//Access Token Modal
jQuery(".link").colorbox({inline:true, width:"90%"});
a.preventDefault();
//Access Token Modal CLOSING
}
});
P.S colorbox is the modal plugin.
I think you shoukd remove the colorbox if there is an error:
});