views:

4289

answers:

1
+5  Q: 

Jquery Unfocus

Hello,

Is it possible to unfocus a textarea. I couldnt find any $('#textarea').unfocus()?

Thanks

+12  A: 
$('#textarea').blur()
RichieHindle
Strange. I am trying to blur() before the window loses focus so that when I come back, the text area is not selected by default. Doesn't seem to work :(
Alec Smart
something like $('window').blur(function() {$('#textarea').blur();});
Alec Smart
maybe you need to blur the text area on window focus then?
Geoff
may be you are trying to bind the event before the DOM is loaded. Try to put the code in the ready handler of the page like this:$(document).ready(function() {$('#textarea').blur()})
Marwan Aouida