I am having some odd behavior with this function:
it is part of a form that has something like this:
Time frame 1
billability (which is a percentage value, but i dont want the % sign, so the above code removes anything that's not a number)
I am using the above inside the percentage input field (as seen in the code)
I have a button that adds a new timeframe, and duplicates the code of the 1st timeframe but increments the id and name of the field
and using the same function for the date...
check the example code
now the problem :
in the initial input box, the code is working fine, it removes any non integer as soon as it is typed (letters or % or anything)
but in the 2nd (and any added ones), i cant even type a number, it's automatically removed...
can someone point out to me what's causing this? thanks
// code in time frame 1
<input type="text" name="billability_1" id="billability_1" onkeyup='this.onchange();' onchange='this.value=this.value.replace(/[^\d]*/gi,"");' >
// code time frame 2 after clicking 'add time frame'
<input type="text" name="billability_2" id="billability_2" onkeyup='this.onchange();' onchange='this.value=this.value.replace(/[^\d]*/gi,"");' >