javascript - How do I display the code as plain text -
this code :
<!doctype html> <html> <head> <p id="x"></p> <p id="y"></p> <style> </style> </head> <body> <button id="btn">click me!</button> <script src="jquery/jquery1.12.js"></script> <script> var txt = '<!doctype html>\ <html>\ <head>\ </head>\ <body>\ <script>\ alert("ok");\ </script>\ </body>\ </html>'; $(document).ready(function(){ $("#btn").click(function(){ $("#x").text(txt); }) }) </script> </body> </html>
how display code plain text.i want each line variable x go new line example :
output :
<!doctype html> <html> <head> end
any help,tankyou.
in #x
element, should use pre
element instead of p
.
plus should move head
body
check out jsbin: http://jsbin.com/qicabanoze/edit?html,js,output
Comments
Post a Comment