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

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

SQL Server - MyCTE query based on 24 hour period (next day) -

php - Using str_replace to translate a MySQL Table in html -