This method shows the results faster than the method of using frameworks.
getElementsByTagName: Used to get elements by their class or id from html.
createElement(“type”): create element creates an element of the passed type
appendChild(node): Appends the passed node at the end of attached parent.
At first output will be like below-
And when B is put inside of the box then output becomes like below-
2) USING JQUERY
JQuery has an inbuilt autocomplete function which takes id and a list of available tags.
Type a letter to see recommendations and click to complete the text automatically.
At first, output will be like below-
And when D is put inside of the box then output becomes like below-
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.