I have a code in which i am changes a tag's inner text with js but i want that tag to call a function when it is changes, i dont know why i doesn't call to the function when it is changes please help.Sorry for my bad english. This is an example of what i am trying to achieve :
<!DOCTYPE html>
<html>
<body>
<h1 id="result"></h1>
<p id="demo" onchange="myFunction()">Click button to change my HTML content</p>
<button id="press" onclick="changeText()">button</button>
<script>
function changeText() {
document.getElementById("demo").innerText = "hhhhhhhhhh";
}
function myFunction() {
document.getElementById("result").innerText = "Text changed!";
}
</script>
</body>
</html>