Monday 25 May 2015

Limit Textbox character After Comma (1234,4567)

function checkNumberWithComma(textBox) {
if ((textBox.value == 0 || textBox.value) && textBox.value.match(/^\d{4,4}(

?:,\d{4})*$/)) {
$(textBox).removeClass("error"
);
}
else {
$(textBox).addClass("error");
}
}
function testFunc() {
checkNumberWithComma(document.
getElementById("test"));
}
$(document).ready(function() {
document.getElementById("
testButton").onclick = testFunc;
});

No comments: