Javascript examples for DOM:Element innerHTML
Hard code HTML entity to Javascript code
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <div id="div"></div> <script> var aa = 'TAGS(\\"a b\\")'; var div = document.getElementById('div'); div.innerHTML = '<a href="#" onClick=passSearchTerm("' + aa + '");>View</a>'; function passSearchTerm(aa) {/*from w ww.ja v a 2 s. c om*/ console.log(aa); } </script> </body> </html>