Replace 0 in form field with empty by jQuery

I haven’t had a chance to check this code but it should empty all fields with the class .numeric that contain 0 only.

$(function() {
    $fields = $('.numeric');

    $.each($fields, function() { 
        if ($(this).val() == 0) {
            $(this).val('');
        }
    }    
}

Leave a Comment