<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>

I want to put the non-Javascript code and Javascript code in two separate variables:

var html = $("#mydiv").html();

My problem here is that 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.

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?

1 Answer
1

<div id="mydiv">
<p>Hello Philippines</p> my first time in Philippines is nice</p>
<code>alert("how was it became nice?");</code>
well i experienced a lot of things
<code>alert("and how about your Japan's trip?");</code>
<p>well its more nicer ^^ but both countries are good! hahah
</p>
</div>