An anchor in my HTML has an onclick attribute like so:
<a href="javascript:void(0);" onclick="javascript:OpenNewWindow('/help_options.asp?ID=23', 350, 250);" class="help_question_mark">?</a>
I'm trying to strip away the JavaScript handlers to get the bare URL and prop it to the href attribute so the result would look like this:
<a href="/help_options.asp?ID=23" class="help_question_mark">?</a>
I figured it'd be simple, just write something like this:
$('a.help_question_mark').each(function(){
help_question_mark_link = $(this).attr('onclick').split('javascript:OpenNewWindow(\'').join('').split('\', 350, 250);').join('');
$(this).removeAttr('onclick');
$(this).attr('href',help_question_mark_link);
});
In jQuery 1.1.1, this seems to work, but not in 1.4.2 which I am limited to using.
Can anybody shed some light on this, I'm in a pickle.
Here's a jsFiddle.
Script URLthat I do not know how to get around.