Reputation: 198
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
Upvotes: 14
Views: 34372
Reputation: 3126
Use attr() for find the value of an attribute
Try this
$(".toolbarField").attr("max");
or
$('#pageNumber').attr('max');
Reference:
Upvotes: 9
Reputation: 5249
$("input").attr("max");
This gets the value of the attribute
See the jQuery API Document for it: http://api.jquery.com/attr/
Upvotes: 3
Reputation: 148110
You can use attr() with id selector to get the value of max attribute.
$('#pageNumber').attr('max');
Upvotes: 21