when I use .html() to put data, the jQuery script doesn't work with the new data. The code is like the this:
<html>
<head>
<script>
$(document).ready(function(){
$("#newhtml").on("click", function(){
alert("I'm the NEW one!");
});
$("#put_new").on("click", function(){
$("#newdiv").html("<input type = 'button' id = 'newhtml' value = 'click on me'/>");
});
});
</script>
</head>
<body>
<div id="newdiv"></div>
<input type="button" id="put_new" value="put new html" />
</body>
</html>
This is a simple example but there is more data I want to put and I want the new elements work with the script in this way. I tried to search on stackoverflow.com but I didn't find any applicable one. Thank you so much.