Sunday, 15 May 2011

javascript - Sanitize codes injection using jQuery -



javascript - Sanitize codes injection using jQuery -

i using comment box , insert value mysql using ajax. same time append entered comment jquery same page. problem if entered text javascript code, like

<script>alert('hello');</script>

it shows alert. in database sanitize these code since append in client side need display entered text is.

well use,

<div contenteditable="true"></div>

any immediate help, please?

the next snippet html encodes string to:

"&lt;div&gt;here html&lt;/div" $("p").text("<div>here html</div").html()

javascript jquery

No comments:

Post a Comment