1
I know through the attribute maxlength
it is possible to limit the number of characters of a input
.
The doubt: This property applies to select
, if not what its equivalent would be, or how to achieve the same objective.
<select maxlength="5">
<option value="opcao" maxlength="5">123456789</option>
</select>
Note that in the above code the attribute does not work, so how to proceed?
I’m afraid I can’t do what you want, the property
maxlength
, applies to the value of the component, but in the case ofselect
, the user will not select an undefined value. In a way, it would be an unused property.– Brumazzi DB
Why do you need this?
– Juliano Alves
@Julian when selecting one of the options, it exceeds its space and overrides "Arrow", the fact is that certain words the letter gets "food" or cut...
– MagicHat
You can limit the maximum number once you put the number in each option. It is not the user to fill in.
– Jorge B.
@Jorgeb. thanks for your attention, these options come dynamically, you have an idea, for me to limit the amount of letters ?
– MagicHat
It seems that your problem is that you want to cut the text that will be presented in the option. Instead of doing this you can think about how to reshape a very large text.
– Juliano Alves
@Juliano Sorry my English not is good but, u can show me any idea, how i can Solve my problem ?
– MagicHat
You want every
option
of a size? Or who runs the size is theselect
?– Renan Gomes
@Thanks for your attention, I would like to limit all with 5 characters for example.
– MagicHat
@Magichat can do this in the language you use to present dynamically, it doesn’t need to be in HTML.
– Jorge B.
@Jorgeb. I see, you have an idea in js ?
– MagicHat
@Magichat depends on how you fetch the data and where. You can put some code?
– Jorge B.