From the course: JavaScript: Web Form Programming

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using dynamic datalists

Using dynamic datalists

From the course: JavaScript: Web Form Programming

Start my 1-month free trial

Using dynamic datalists

- [Narrator] Previously we looked at the datalist element, which can be used to create an auto complete experience for filling out form fields. And we saw how to define datalist elements within the page and provide a set of values using the option tag. In this example, we're going to take a look at how we can use the datalist element to generate those values dynamically, instead of having them predefined in the page. So you can see here, I've opened up the dynamic list "start file" in the editor, and this example is a little different than the earlier one. So let's go over to the browser really quick. So this page contains a form very similar to what you might see on an Investment company's site that lets you trade stocks. So what we're going to do is create dynamic datalists for the stock symbol and the share quantity fields here in the form. So let's go back to the code. And you can see here in the HTML, I have two empty…

Contents