[Solved] javascript onclick alert not working


What exists is that is based off an object

discuss = discuss || {};
discuss.reply = discuss.reply || {}
discuss.reply.submit = function() {
   alert("xxx");
}

or if the code already exixts, you can just override it

discuss.reply.submit = function() {
   alert("xxx");
}

This will override the default function. Meaning, it will not do what it did before. If you still want this to be called you can copy the old one and call it.

var _org = discuss.reply.submit;
discuss.reply.submit = function() {
   alert("xxx");
   _org.apply( this, arguments );
}

1

solved javascript onclick alert not working