From the course: JavaScript: Web Form Programming

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

The details element in forms

The details element in forms

- [Instructor] In some scenarios, your form might have controls that are optional or not critical to the user's task, and you might want to have an option for exposing those controls only if the user wants to see them. And you can make use of the details element for this use case. Now, it's not strictly a form control, but it gives you the ability to hide and show optional content without having to use JavaScript or some other fancy control library. So let's take a look at details_start in, oops, in our live server. All right. So, we're using the same form from the previous output element example, but the difference is that, in this case, we have some additional form controls that are optional to the user's stock trade. So because only a subset of users will want to fill these out, we can provide a way to hide and show them using the details element. So let's go back to the code and implement this. The details element consists of two parts. There's the summary and the content. So…

Contents