I have 3 divs that i need to put them only accepting numbers. I have tried to append the "onkeypress" function but it still accepts numbers. Is there anyone here that can help me out? I cant seem to find where the problem relies.
This is the code:
document.getElementById("cc-num").maxLength = 16;
document.getElementById("zip").maxLength = 5;
document.getElementById("cvv").maxLength = 3;
$("#cc-num").append("onkeypress='return event.charCode >= 48 &&
event.charCode <= 57'");// makes the Card Number div only digit
available.
$("#zip").append("onkeypress='return event.charCode >= 48 &&
event.charCode <= 57'"); // makes the Zip div only digit available
$("#cvv").append("onkeypress='return event.charCode >= 48 &&
event.charCode <= 57'"); // makes the cvv div only digit available.