Skip to content
Advertisement

Change Text box value based on Data list selected value – PHP

I’ve created a table with two columns ‘id’ and ‘names’ and in my PHP(html) page added data list and text area to display it, data list options are filled with ‘id’ and i want the text area to show the ‘name’ of the ‘id’ i selected in the data list.

JavaScript

This is my part of the code –

JavaScript

I looked up to some of the answers, some of them said to use ajax, but i’ve not gotten a good example to refer and complete my code. If this was already solved, please comment answer links.

Advertisement

Answer

Well, i’ve made it work in a very different way, i.e data-value and with the help of this answer – https://stackoverflow.com/a/48076273/14890948

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement