by ishanjain » Tue May 19, 2015 11:19 am
Take the example of following code. Whenever button is clicked mymethod() runs. So whenever mymethod() runs I want to get notified. In this example on button click it runs but in the various application, it is not necessary it runs on button click only.
"<!DOCTYPE html>
<html>
<head>
<script>
function mymethod() {
document.getElementById("demo").innerHTML = "Paragraph changed.";
}
function mymethod1() {
document.getElementById("demo1").innerHTML = "Paragraph changed1.";
}
</script>
</head>
<body>
<h1>JavaScript in Head</h1>
<p id="demo">A Paragraph.</p>
<button type="button" onclick="mymethod()">Try it</button>
</body>
</html>"