HTML Snippet -> Java Script and HTML

0
Hello, I want to call Java script that will invoke a service to return  a report/Dashboard, and i want to pass the report to a div element and display Report on a page. I was thinking of using html snippet, but am not able to invoke java script and html. As a POC, I  was trying to invoke below code and its failing as its not able to find the java script.  <div id="add_to_me">         <h1>Click Me</h1>         <p>This is the text which has already been typed into the div</p>     </div>     <script>         function addCode() {             document.getElementById("add_to_me").innerHTML +=                "<p>This is the text which has been inserted by JS</p>";         }     </script>       <button onclick="addCode()">Add Stuff</button>   Thanks. 
asked
2 answers
2

Hi, 

The Code that you added should work. If not, try removing the enclose in the DIV checkbox or have two snippets added one for HTML and another for JS if you are planning to use JQuery in the future. 

 

Hope this helps!

answered
1

Hi rajesh khatri,
You need to place the DiV elements in  a seperate Html snippet and below which 
u can add a JavaScript snippet place the script code inside it 
and your code works 

Cheers,
Narendran J

answered