Custom Attribute For Numbers and Min and Max

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.

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">

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

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.

https://stackoverflow.com/questions/5995628/adding-attribute-in-jquery

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