Reputation: 14863
Simple use case: Textarea and Button, when the button is clicked, the text in the Textarea changes.
Sample: JS
$('button').click(function(){
$('#t1').text('test');
});
HTML:
<textarea id="t1" cols="10" rows="5"></textarea><button>Clear</button>
However when I change the button and then click the button the Text doesn't change in Chrome and Firefeox (in IE10 it works as). (Tested in the latest versions of Chrome and Firefox)
When I debugg it and, check the text of the textarea, it displayes the correct valeu.
Is this a browser bug, jQuery bug or am I missing something?
Upvotes: 4
Views: 2368
Reputation: 337570
A textarea
element has a value, so use val('')
to set it, like this:
$('button').click(function(){
$('#t1').val('test');
});
Upvotes: 4