What?! I know what a bad idea.
Firstly, I can’t control the output of html, it is from the supplier, and it is created through their crazy system with which our company agrees. (not to mention the situation, I know that this is not optimal)
In html, I have:
<a id="notify" onclick="location.href='index.php?foo=bar';return false;" href="javascript:;">Notify!</a>
In my JS if I do this:
console.log($("#notify").attr("onclick"))
I get:
onclick(event)
Which makes sense, but I need to change the onclick attribute, so it reads something like:
onclick="location.href='index.php?foo=bar&zoobazz=moo';return false;"
even better if I could remove onclick and replace the value of the href attribute with location.href.
source
share