How to find value in max attribute of input element

How to find value in 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 did not help

+3


source to share


3 answers


You can use attr () with the id selector to get the value of the max attribute.

Live Demo



$('#pageNumber').attr('max');

      

+12


source


$("input").attr("max");

      

Gets the value of an attribute



See the jQuery API doc for it: http://api.jquery.com/attr/

+2


source


Use attr () to find the value of an attribute

try it

$(".toolbarField").attr("max");

      

or

$('#pageNumber').attr('max');

      

Link:

http://api.jquery.com/attr/

+1


source







All Articles