I spend all night just to play with this code but I have no idea why it's not return the correct statement :
<input id="price_item" discount="10" more_order="20" type="text" name="co-price-item" value="0" onChange="selection()"/>
function selection(){
var discount = $('#price_item').attr('discount');
var more_order = $('#price_item').attr('more_order');
var input_value = $('#price_item').val();
if(input_value > more_order) {
alert('yes : '+input_value+' > '+more_order);
}else{
alert('no : '+input_value+' < '+more_order);
}
}
what is wrong with the code caused it already return yes by entering input value started from 3. I hope it return yes if above 20.
I have tried to use
var input_value = document.getElementById("price_item").value;
but still got the same result.