javascript - Price Field Validation -
there form field displayed in form "zzzzzzz.zz". example if form field 5, displayed 5.00; if form field 005, displayed 5.00; if form field spaces, displayed null entry. ever change on "onblur".
i believe looking for? http://jsfiddle.net/c7yph/1/
$("#foo").blur(function() { $(this).val(number($(this).val()).tofixed(2)); }); also, above requires source jquery , have within $(document).ready.
jquery idea if plan js... plain js: http://jsfiddle.net/c7yph/2/
document.getelementbyid("foo").onblur=function(){ this.value = number(this.value).tofixed(2); };
Comments
Post a Comment