Iam creating a dynamic input and applying a class to it, but its not working.
My class:
$(".numeric_input").keypress(function(e) {
var a = [];
var k = e.which;
for (i = 48; i < 58; i++)
a.push(i);
if (!(a.indexOf(k)>=0))
e.preventDefault();
});
My code:
var table = document.getElementById('sizeTable');
for(var i=0;i<sizes.length;i++) {
$("<td></td>").html('<input type=text class=numeric_input name=rows['+i+'].quantity>').appendTo(tr);
$(tr).appendTo(table);
}
The same class applied to other elements are working fine. Any help