Change the value of an existing onclick function
<p>I have a page that is pulling in via an iframe a page of html content from a pre-existing content management system, whose content I can not directly change. I want to use jquery to alter some of the links and button locations dynamically.</p>

<p>For links within the page I was able to change the href attr values of </p>

<pre><code>&lt;a href="/content.asp"&gt;more&lt;/a&gt;
</code></pre>

<p>from content.asp to content2.asp using</p>

<pre><code>$("a[href^='/content.asp']")
.each(function()   {       this.href = this.href.replace("content.asp",          "content2.asp");   });
</code></pre>

<p>But the page pulled in also has form buttons that contains javascript onclick functions e.g. </p>

<pre><code>&lt;INPUT type="button" value="Add to basket" onClick="document.location='/shopping-basket.asp?mode=add&amp;id_Product=1076';"&gt;
</code></pre>

<p>I basically want to use jquery to select any such buttons and change the shopping-basket.asp to shopping-basket2.asp</p>

<p>How can I select these buttons/onclick functions and change the location string?</p>
