javascript - Convert innerHTML to text and put into textarea not working -
i want take inner html (both tags , text) of element , put in textarea, somehow not working. how can make work , why not working?
html:
<div id="element"> <p>some text</p> <p>some text</p> </div> <button>click me</button>
js:
$("button").click(function(){ $("#element").html("<textarea>"+$("#element").text($("#element").html())+"</textarea>"); });
$("#element").text($("#element").html())
there's problem should be
$("#element").text()
edit:
Comments
Post a Comment