Reputation: 620
I'm trying to change attribute of a textarea on focus, but it's not working.
HTML:
<textarea name='naziv' id='name'>Naziv</textarea>
Jquery:
$('textarea#name').focus(function(){
$(this).attr('readonly','readonly');});
Upvotes: 0
Views: 68
Reputation: 40038
Actually, your code works. In jsFiddle you forgot to tick off the jQuery library.
Under Frameworks & Extensions, choose a jQuery version.
Upvotes: 1