I have an script which runs once the page is loaded
$("#node-title").html("Node 0");
I want to create an event (clicking on a button) which will change the the node title innerHtml
$( "button#new-child" ).click(function () {
...
$("#node-title").html("Node " + counter);
});
where counter is defined in the code.
This doesn’t work, and I think its because I can’t override the first script. How can I fix this?
With the correct markup, it should work. Have a look at the HTML and JavaScript in this jsBin: http://jsbin.com/utucej/1/edit