$1 = 10;
$2 = 30;
$3 = 5;
$("#bidtmp").val('');
if ($1 > $2) {
$("#bidtmp").val('1');
} else if ($2 > $3) {
$("#bidtmp").val('2');
} else if ($3 > $1) {
$("#bidtmp").val('3');
} else if ($1 > $3) {
$("#bidtmp").val('1');
} else if ($2 > $1) {
$("#bidtmp").val('2');
} else if ($3 > $2) {
$("#bidtmp").val('3');
}
how to sort values in ascending order using jquery? Above is the code what i have tried?
You can try:
From your code it seem you’re trying to set max value to
#bidtmpand for that above will work.But for sorting try sort() method like below:
for descending
return b-a;.