I have this div with a data attribute that may contain escaped html value
<div id="test" data-title="<script>alert("Hello");</script>"></div>
Now, when I read the value of the data attribute, it is not automatically displayed. For example, the following code will trigger an alert.
$(document).ready(function(){ $("#test").append($("#test").data("title")); });
See jsfiddle http://jsfiddle.net/FJTW8/3/
Why does he get unlimited and what solution.
source share