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 ); 

jsfiddle demo


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -