Replace input in real time with jQuery -
i have problem script, want replace entered in input field specific letter in real time, hello world in field.
<input id="inputid" type="text" value="" maxlength="11"/> $('#inputid').keyup(function(e){ var cv=["h","e","l","l","o"," ","w","o","r","l","d",""]; var i=$('#inputid').val(); (j=0;j<11;j++){ this.value = this.value.replace(i[j],cv[j]); } }); this script works when write not when write quickly. help
try way:
$('#inputid').keyup(function(e){ var cv = 'hello world'; this.value = cv.substr(0, this.value.length); });
Comments
Post a Comment