IT Certificaions

Google Cloud Platform

Tuesday, January 22, 2013

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());
    });