Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html table input integer type? [duplicate]

I made a table where input is integer, but somehow I am still able to pass any text.

<tr>
      <td>number: </td>
      <td><input type="integer" name="number" value=""/></td>
    </tr>

is the type="integer" correct?

like image 940
Martin Švejda Avatar asked Apr 06 '26 14:04

Martin Švejda


1 Answers

In short, integer is not the correct type - what you seek is number

<input type='number' />

Additional attributes for this type of input are possible, including:

  • min: the lowest value the input will allow
  • max: the highest value the input will allow
  • step: the incremental value that the up/down selectors will increment the current value by

More information & example usage from MDN

like image 121
Professor Abronsius Avatar answered Apr 09 '26 02:04

Professor Abronsius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!