<p>HI All,</p>

<p>I have a piece of javaScript that removes commas from a provided string (in my case currency values)</p>

<p>It is:</p>

<pre><code>    function replaceCommaInCurrency(myField, val)
    {
        var re = /,/g;

        document.net1003Form.myField.value=val.replace(re, '');
    }
</code></pre>

<p>'MyField' was my attempt to dynamically have this work on any field that I pass in, but it doesn't work, I get errors saying 'MyField' is not valid. I sort of get my, but I thought this was valid.</p>

<p>I am calling by using: onBlur="replaceCommaInCurrency(this.name, this.value);return false;"</p>

<p>this.name and this.value are passing in the right values...field name and its value.</p>

<p>How do I do this dynamically?</p>

<p>-Jason</p>

If you code it right into the markup like that, e.g. onblur="replaceCommaInCurrency(this)", the control originating the event gets passed as the parameter.  Then you should be able to do something like:
```
```
myField.value = myField.value.replace(re, '');
```
```
with jQuery:
```
```
var jqField = $(myField);
jqField.val(jqField.val().replace(re, ''));
```
```