user1025275
user1025275

Reputation: 198

How to find the value in the max attribute of input element

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

Answers (3)

Nandu
Nandu

Reputation: 3126

Use attr() for find the value of an attribute

Try this

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

or

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

Reference:

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

Upvotes: 9

97ldave
97ldave

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

Adil
Adil

Reputation: 148110

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

Live Demo

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

Upvotes: 21

Related Questions