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
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
You can use attr() with id selector to get the value of max attribute.
$('#pageNumber').attr('max');
attr('max') and val() seem to return strings when used on a number input type element (jquery-1.12.3).parseInt() it.Use attr() for find the value of an attribute
Try this
$(".toolbarField").attr("max");
or
$('#pageNumber').attr('max');
Reference:
$("input").attr("max");
This gets the value of the attribute
See the jQuery API Document for it: http://api.jquery.com/attr/