Sidetik
Sidetik

Reputation: 620

Textarea change on focus

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');});

JsFiddle

Upvotes: 0

Views: 68

Answers (1)

cssyphus
cssyphus

Reputation: 40038

Actually, your code works. In jsFiddle you forgot to tick off the jQuery library.

Under Frameworks & Extensions, choose a jQuery version.

Fixed jsFiddle

Upvotes: 1

Related Questions