There are plenty of examples showing how to set min and max with integers. I need to ensure the range of values can even be float. Below is how I'm setting the attributes value and max for the input type refund_amount. The problem here is that one can enter a value higher than max value set with Jquery.
window.onload = function() {
var src = document.getElementById("grand_total");
var dst = document.getElementById("refund_amount");
if (dst != "") {
dst.setAttribute("value", src.textContent);
dst.setAttribute("max", src.textContent);
}
};
HTML:
<tr>
<td align="right" colspan="3">Enter Refund Amount</td>
<td align="left" colspan="4"><input type="text" size="11" id="refund_amount"
name="refund_amount" value='' min="" max="" required/></td>
</tr>
How do I ensure it never allows higher value than what max attribute holds?