How to find the value in the max attribute of input element using Jquery
<input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1" tabindex="7" max="29">
I tried
$("input[max]").val()
But it didn't help
The max attribute defines the maximum value that is acceptable and valid for the input containing the attribute.
The value attribute specifies the value of an <input> element. The value attribute is used differently for different input types: For "button", "reset", and "submit" - it defines the text on the button. For "text", "password", and "hidden" - it defines the initial (default) value of the input field.
Complete HTML/CSS Course 2022 To limit an HTML input box to accept numeric input, use the <input type="number">. With this, you will get a numeric input field. After limiting the input box to number, if a user enters text and press submit button, then the following can be seen “Please enter a number.”
Updated on Jul 13, 2022. The PHP variable max_input_vars was introduced in PHP 5.3. 9+ as a security measure to limit the maximum amount of POST variables submitted. It represents the number of variables your server can use to run a function.
You can use attr() with id selector to get the value of max attribute.
Live Demo
$('#pageNumber').attr('max');
Use attr() for find the value of an attribute
Try this
$(".toolbarField").attr("max");
or
$('#pageNumber').attr('max');
Reference:
http://api.jquery.com/attr/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With