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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -