Streaming live at 10am (PST)

Custom Attribute For Numbers and Min and Max


#1

Hello,

I am trying to figure out how to add a custom attribute to one of my text fields, that limit the user to only be able to input Numbers, and only within a MIN and MAX range.

Is this possible?

Thank you.


#2

Hey @Dushaan

Webflow does not allow you to set a form field attribute to type="number" due to security reasons. You can insert a number field into your form with a min-max value using a html embed as follows;

<input type="number" name="quantity" min="1" max="5">


#3

Thank you @AlexManyeki . How do I Target this only to specific text fields?


#4

That attribute is already applied when you embed the code that way.

If you want to apply it to several fields then you need to embed several inputs that way as needed. (easy way)

Alternatively you could apply those attributes to multiple inputs with jQuery by targeting their classnames.


#5

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.