Hi,

Newbie learning jQuery. Failing miserably.

I am trying to implement http://decorplanit.com/plugin/ autoNumeric().
Automatically adds commas to numeric fields.

Got the plugin working fine.

Need code to copy contents of one text box to another (on blur) and
then remove commas by running  $.fn.autoNumeric.Strip('id of the input
field that you want to remove the format');

This is how it has been done on the site but I just can’t work out.

jQuery(function($) {
        $('input.auto').blur(function(){
                var convertInput = '';
                if(this.name != 'decimal' && this.value != '' && this.id != 
'ii1'){
                        var     ndb = 'db' + this.id.charAt(2);
                        var nid = 'ni' + this.id.charAt(2);
                        convertInput = $.fn.autoNumeric.Strip(this.id);
                        document.getElementById(ndb).value = convertInput;
                        document.getElementById(nid).value = 
$.fn.autoNumeric.Format(nid,
convertInput);
                }
                if((this.id == 'ii1' || this.id == 'dpb') && this.value != ''){
                        convertInput = $.fn.autoNumeric.Strip('ii1');
                        var i = 1;
                        for (i=1; i <= 9; i++){
                                document.getElementById('ni'+i).value = 
$.fn.autoNumeric.Format
('ni'+i, convertInput);
                        }
                }
        });
});

Reply via email to