Execute scripts inside document.getElementById().innerHTML


 Execute <script> (Java Script) tag from innerHTML
 -------------------------------------------------------------
 1. Replace <script> your script data to be executed. </script> tag
    with <div class="javascript">your script data to be executed. </div> 


2. add a style in your page...
   <style type="text/css"> .javascript { display: none; } </style>

3. Now run  eval using jquery(Jquery js should be already included)
     $('.javascript').each(function() {
      eval($(this).text());
    });

Comments

Post a Comment

Popular posts from this blog

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

Upload csv file at Google Cloud Storage using java

Read Images from a xlsx file using Apache POI