I want to add contents on loading the page and remove the contents while saving to DB.
My response has a
On load:
I got the response and try to put into test field
var element = document.createElement("pp");
var test = $j(element ).attr("id", "exam").addClass("exam");
test.innerHTML = "test script <div>test</div><script src=\"test.js\" src=\"text/javascript\"></script>";
While accessing test[0].outerHTML i am just getting as
<pp class="exam" id="exam"></pp>
But i am expecting an output as
<pp class="exam" id="exam">test script <div>test</div><script src=\"test.js\" src=\"text/javascript\"></script></pp>
Let me know what's wrong in this
On Save:
I am getting the contents of the text field
$j("#textfield").html() which has <pp class="exam" id="exam">Test<script src="test.js" src="text/javascript"></script></pp>
now i need to escape the
<pp class="exam" id="exam"></pp>
so i used
$j("#textfield").html().html() which is stripping the <script> tag.
Let me know how i can retain <script/> tag in this case.