Change value of Onclick function vars
<p>I have the onClick function attached to a button. I want to be able to change the function var from 'create' to 'update' on the page load and through other functions. I have tried the code below but no luck.</p>

<pre><code>&lt;input type="button" name="save_customer" id="save_customer" value="Save" onClick="customer_crud('create')" /&gt;

var js = "customer_crud('read')";
// create a function from the "js" string
var newclick = new Function(js);
// clears onclick then sets click using jQuery
$("#save_customer").attr('onClick', '').click(newclick)
</code></pre>

<p>Any ideas.</p>

<p><strong>UPDATED</strong></p>

<p>Ok in a nutshell i want to change the attr onClick like you would change the attr name &amp; type.</p>

<pre><code>&lt;input type="button" name="save_customer" id="save_customer" value="Save" onClick="customer_crud('create')" /&gt;
</code></pre>

<p>to</p>

<pre><code>&lt;input type="button" name="save_customer" id="save_customer" value="Save" onClick="customer_crud('update')" /&gt;
</code></pre>

<p>Thanks</p>
