javascript - Regular Expression is not working using onkeyup function -
$(function(){ $('#addaction').click(function(){ count += 1; $('#extras').append('<div class="row"><div class="col-md-1">delivery fee: </div><input id="price_' + count + '" name="prices[]' + '" type="text" onkeyup="javascript:this.value=this.value.replace(/[^0-9.]/g, \'\');" /></div>' ); }); });
i don't know why regular expression not replacing value empty string. if want add alphabet value in numeric field, alphabet value should remove numeric field, tried, not working, kindly tell me proper solution.
javascript:
needed href
attribute of anchor elements.
<input type="text" onkeyup="this.value=this.value.replace(/[^0-9.]/g, '');" />
Comments
Post a Comment