I need to check if the last character of an input (type="number"
) value is a dot!
Tried these, but it doesn't work:
let amount = $("#amount").val();
let last_char = amount.slice(-1);
if(last_char == ".")
{
return;
}
Also tried amount[amount.length-1]
and charAt()
P.S. Input type is type="number"
Edit:
None of the answers work: https://jsfiddle.net/dne37hao/