So I have a cool one for ya.
I need to scan my html document as it is rendering and replace every
href=""
with
onclick="window.location=''"
more than that, I need to carry the link from the href to the window.location.
For example, if I had:
href="http://www.google.com.au"
it would become:
onclick="window.location='http://www.google.com.au'"
and I need it to do this on every href in the document
I have no idea, but it needs to be in jQuery / javascript 😀
Thanks guys.
You could try this:
What are you trying to achieve with this? Chances are that there’s a more elegant way to achieve what you’re after.
For example, it might be better to handle the event yourself in the JS. Replace the third line with:
That could become very expensive though, so you might want to consider jQuery’s
delegateevents: http://api.jquery.com/delegate/