I have a HTML page where there are many <a onclick="javascript>
What i need to do using Jquery is find the below tag as it is
<a onclick="javascript:OpenNewWindow('/help_options.php?ID=2', 350, 250);" href="javascript:void(0);">
and replace it with
<a onclick="javascript:OpenNewWindow('/help_options.php?ID=2', 600, 500);" href="javascript:void(0);">
Note
1) the values 350 is changes to 600 and 250 is changed to 500
2) there are also many similar tags but i want the code to do Exact find and replace of the above tag.
IS this possible ?
I wouldn’t be looking to change the inline
onclickJavascript even if I could.A better approach is to late-bind everything in JavaScript:
So, when you did want to change the event, you
unbindthen re-bind. I.e. do something like:Of course, that approach just does it for an anchor with a particular id. You could just select ‘a’ to get all anchors.
A simpler solution might be to define an object literal:
Use that in the function:
And just change the values of this when you need: