Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

jquery

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

like image 462
user1025275 Avatar asked Jan 29 '13 11:01

user1025275


People also ask

Which attribute specifies the maximum value for an input field?

The max attribute defines the maximum value that is acceptable and valid for the input containing the attribute.

What is the value attribute in input element?

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.

How do you limit the input value of a number?

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.”

What is Max input?

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.


2 Answers

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

Live Demo

$('#pageNumber').attr('max');
like image 127
Adil Avatar answered Sep 28 '22 05:09

Adil


Use attr() for find the value of an attribute

Try this

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

or

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

Reference:

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

like image 22
Nandu Avatar answered Sep 28 '22 03:09

Nandu