I have the following code to check if the users' text does not contain the two forbidden characters and it does go the way I want. the problem is that for the texts containing the forbidden characters, I want to focus on the input after the alert goes off. yet the css style is applied to the input.
What point am I missing in this piece of code?
$(".option, .fixed").blur(function(){
var str = $(this).val();
if(str.indexOf("|") >= 0 || str.indexOf(":") >= 0) {
alert("The informatin you provided contains illegal characters( | : )");
}
$(this).css('border','1px solid pink').focus();
});