how do i create dynamic data using a value of form?

You could add an ID to the select like id = "first"

Then you could grab the select dropdown using Vanilla JS, and get its text value like:

var dropdownElementFirst = document.getElementById("first");
var selectedItemsText = dropdownElementFirst.options[dropdownElementFirst.selectedIndex].text;

selectedItemsText will hold the value of “yes” or “no”

edited:

Watch the select option changing with a change event in js

first.addEventListener("change", function() {
    if(first.value == "yes")
    {
        //do something
    }
});

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top