Javascript for replacing an abreviation by his equivalent
问题 I met some trouble with a javascript. In fact I have in my database many records that are abreviations and ther equivalent, for example, replace tel => telephone etc... So I have this function $('#tags').keyup(function(e){ var code = e.which ? e.which : e.keyCode; console.log(code); if (code == 'tel'){ var input = this.value; input = input.substr(0, input.length -1); console.log(input); input += 'tel'; this.value = input; } }); Actualy this does not work the trouble is that I do not have aby