Is it possible to detect if the content of a paragraph has been changed in JQuery ?
I tried the below code.
<p id="test">Text</p>
<button id="submit1">change</button>
-
$(document).on("click", "#submit1", function () {
var d = new Date();
var time = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
$("#test").text(time);
});
$(document).on("change", "#test", function () {
alert("Paragraph changed");
});
JSFiddle : http://jsfiddle.net/nnbqye55/
I guess I am missing something obvious.