Access the chose value of data list in the form

can someone please provide me the code to access the chose value of the datalist in the form

Have any HTML indicating what value you are attempting to retrieve? Or any code that isn’t doing what you want it to do?

i want to access the option that has been choosen from the list using javascript

var sel = document.getElementById("facultys");
var val = sel.options[sel.selectedIndex].value;

BTW, it should actually be “faculties”

1 Like