I have textbox that I want to run some jquery when the textbox loses focus, so after the user clicks out of the text box.
I have tried to do this
$("#textbox").focusout(function () {
alert("hello");
});
but I get an error saying Object doesn’t support this property or method.
How can I do this then?
focusoutwas added in v1.4. Three thoughts:textbox?$)? If so, use jQuery’snoConflictmode and usejQueryinstead of$.Other than that, it should (does) work.
Here’s an example (using an alert as you did): http://jsfiddle.net/QzmZp/1/
and another not using an alert (because that freaked IE7 out): http://jsfiddle.net/QzmZp/2/
Someone earlier asked about browser versions, I’ve tried the above with Chrome 5, IE6, IE7, and FF3.6; all fine.
I did both an
inputand atextareabecause I wasn’t sure which you were using.