i am trying to change a js function (within the HTML) or add an event listener on one when it is used (from other parts from the site).
replaceing the js object by changing the innerHTML won't work even when i set it to "" i still can access the function. Eventlistener seems not to work with these either.
Is there any way to change that?
the script i want to change:
<head><title></title>
<script language="JavaScript">
function add(message) {
alert(message);
}
</script></head>
edit:changed the script
you could wrap and redefine the original function name. For instance to affect the code you posted above you would do something like:
var _add = add;
add = function (){
// do other stuff
_add();
}