I have a form that contains input:
<input onchange="checkDomain(true); return false;" type="text" id="dsearch" value="" name="domain" maxlength="30"/>
Which works just fine in Opera, Chrome and IE – but Firefox and Safari are having problems with calling the function checkDomain(). I added a line into the function for debugging:
function checkDomain(check)
{
console.log('checkDomain() called!');
// do rest of the stuff...
}
So, Chrome/Opera/IE calls the function with no problem after you enter text and click somewhere else – but Firefox/Safari doesn’t. Anyone have a clue?
I cannot remember where I read it, but you should use
.keydown()/.keyup()/.keypress()(whatever suits your needs) instead of onchange. At least forinput[type=text].you can use
.blur()and.focusfor their respective purposes too.Seeing this in your question: “after you enter text and click somewhere else”, makes me conclude you need the .blur() function.