javascript - How to populate the textbox -
this idea.
for instance, have on list
namelist = [ { 'id': 1 , 'name': "fred" }, { 'id': 2 , 'name': "dale" }, { 'id': 3 , 'name': "denmark" } ]
and have on template
for example:
name: <input type='text' name='name'> id: <input type='hidden' name='id'>
what want here that, whenever type name 'fred' in first textbox, automatically,the id become 1. if type 'dale', become 2. reason want kind design want id saved database. think need use javascript not have idea how it. please... appreciated. thank in advance
don't have enough reputation comment posting answer not sure want.
if looking auto-complete type input type , gives suggestion , select 1 of suggestions below example can you. here have flexibility want show user , want use value later on can save in db.
https://jqueryui.com/autocomplete/
http://demos.jquerymobile.com/1.0rc2/docs/forms/search/
if not want please explain question little bit , have tried far.
Comments
Post a Comment