Reputation: 1279
i have textarea and lot of other HTML elements inside one div, like this:
<div id="holder">
<textarea id="txt">Some text</textarea>
<img src="/someurl/test.png" />
<div class="test">Blah</div>
</div>
When i try to get all html inside "holder" div, with code below, it works well. BUT if i change textarea value, and try to get html again, value of textarea is still "Some text", not new text. How to get new, updated text?
Here is how i get html of "holder":
$("#submit").click(function(){
alert($("#holder").html() );
});
And here is jsfiddle example:
Upvotes: 1
Views: 998
Reputation: 140234
Update the textarea html manually:
$("#submit").click(function() {
$("#txt").html(function() {
return this.value;
});
alert($("#holder").html());
});
Upvotes: 4