Prevent Javascript Execution in JQuery html()
- by Mahan
well i do have a div that contains some more html and a lot of javascript on it
<div id="mydiv">
<p>Hello Philippines</p> my first time in Philippines is nice
<script type="text/javascript">alert("how was it became nice?");</script>
well i experienced a lot of things
<script type="text/javascript">alert("and how about your Japan's trip?");</script>
well its more nicer ^^ but both countries are good! hahah
</div>
now what i want there is to put the non-javascript code and javascript code in two separate variables
var html = $("#mydiv").html();
but my problem here is my javascript is executing..which makes me stop to create the code i want which is the storing of javascript and non-javascript to two different variables.
now my questions is
how can i stop the javascript codes from executing when they are
get inside the div?
how can i store the javascript and non-javascript code into two different variables safely?
NOTE: i need the stored javascript for later execution