• Resolved stephenm

    (@stephenm)


    Hi there…..thanks again for a great plugin..:)

    we have an input number / digit field but want it to increment by 0.01 0.02 etc….this can be done via step attribute but doint see it as an option…..any help would
    be great.

    S

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @stephenm

    Assuming the field you want to edit is the fieldname1, please, insert a “HTML Content” field in the form and enter the following piece of code as its content:

    
    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    fbuilderjQuery('[id*="fieldname1_"]').attr('step', 0.01);
    });
    </script>
    

    If you want to apply this modification to multiple number fields, you can assign to all of them a custom class name, for example: my-special-number

    Note: The class names are assigned to the fields through their attributes: “Add CSS Layout Keywords”

    and then, the piece of code to enter into the “HTML Content” field should be edited as follows:

    
    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    fbuilderjQuery('.my-special-number input').attr('step', 0.01);
    });
    </script>
    

    and that’s all.
    Best regards.

    Thread Starter stephenm

    (@stephenm)

    Thanks for the reply…..now i did try
    $(‘#fieldname2_1’).attr(‘step’, 0.01);

    but its not applying the step attribute to the input html

    <input id=”fieldname2_1″ name=”fieldname2_1″ class=”field digits large valid” type=”number” value=”” placeholder=”g” autocomplete=”new-password” aria-invalid=”false”>

    if you could advise?

    Plugin Author codepeople

    (@codepeople)

    Hello @stephenm

    I’ve recommended you a code, but if you decide to use your own code and don’t follow my instructions, there is no way I can help you.

    Please, insert the “HTML Content” field with the following piece of code:

    
    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    fbuilderjQuery('[id*="fieldname2_"]').attr('step', 0.01);
    });
    </script>
    

    Or if you prefer to use the complete field’s name:

    
    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    fbuilderjQuery('#fieldname2_1').attr('step', 0.01);
    });
    </script>
    

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add step attribute to input number field’ is closed to new replies.