But how can we convert it to string?
That is very simple, we just asign the .html() to a javascript variable.
var v = $("#xxx").html();
The variable v will be change to a string that about .html() content.
DEMO
<html> <body> <div class="demo"> <h2>DEMO</h2> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> function test(){ var v = $("#asignHtmlToString").html(); alert(v); } </script> <button id="asignHtmlToString" onclick="test();">Click Me</button> </div> </body> </html>
Related Articles
jquery disable button
The variable v will be changed
ReplyDelete___________________________________________________
Diablo 3 Gold|Rs Gold|Runescape Gold|Buy Diablo 3 Gold