169
rated 0 times
[
173]
[
4]
/ answers: 1 / hits: 18273
/ 8 Years ago, mon, april 11, 2016, 12:00:00
I want to detect changes in div-elements. I tried already the addEventListener with some types (e.g.: change, load).
Here is my example, but the event won't trigger:
<!doctype html>
<html>
<head>
</head>
<body>
<div id='DivElement'>Test Div Text...</div>
<button type=button onclick=EditDivElement()>click me!</button>
<script>
function EditDivElement() {
ClickCounter++;
SelectedDiv.textContent=new text content: + ClickCounter;
}
function OnDivEdit() {
alert(success!);
}
var ClickCounter = 0;
var SelectedDiv = document.querySelector(#DivElement);
SelectedDiv.addEventListener(change, OnDivEdit);
</script>
</body>
</html>
(Edit: It's for a browser-addon and it should be used on other websites.)
More From » javascript