javascript - can i get maximum value from text field when text field have same class name and id in jquery? -
i want higest value text field link
html
<input class="myclass" name="foo1" id="foo1" type="text" value="57"> <input class="myclass" name="foo1" id="foo1" type="text" value="24"> <input class="myclass" name="foo1" id="foo1" type="text" value="11"> <input class="myclass" name="foo1" id="foo1" type="text" value="78">
js
$(".resbobot").each(function() { if (parseint($(this).val()) > parseint($(this).val())) alert ("maximum value is"+??); });
yes need store maximum value in temp variable:
var max = 0; $( '.myclass' ).each( function() { if( parseint( $( ).val(), 10 ) > max ) { max = parseint( $( ).val(), 10 ); } } ); console.log( max );
Comments
Post a Comment