Add mask to input
- by Lodewijk Wensveen
I'm trying to achieve the seemingly impossible task of adding an mask to a input field.
I have the following code:
function addActivationCode(){
newRow = jQuery("div.activationcode:last-child").clone();
newRow.insertAfter(jQuery("div.activationcode:last-child"));
newRow.attr("id", "coderow-" + Math.round(Math.random() * 10000));
newRow.find("input").val("");
find("input").mask("9999-9999-9999-9999");
newRow.find("a.coderemove").attr("onclick", "removeActivationCode('" + newRow.attr("id") + "'); return false;");
}
function removeActivationCode(id){
jQuery("div#" + id).remove();
}
Now I to get the .mask working on my input fields, so far I've only got it working on the new row I'm making and not on the original one.
Can anyone help me out?