GUVI
Back

JS-8

Created 2 years ago
56 Views
1 Comments
BhargaviPYAQ2J
@BhargaviPYAQ2J
BhargaviPYAQ2J
@BhargaviPYAQ2JProfile is locked. Login

Display the value of selected option in paragraph tag with id 'selectedOption' using Javascript. Note: Values are changed dynamically for evaluation.

MY CODE =>

function getSelectedOption(){

let select = document.getElementsByTagName("select")[0].options;

let selectedIndex = select.selectedIndex;

document.getElementById("selectedOption").innerHTML = select[selectedIndex].value

}

getSelectedOption();

If I give my input as Option 1, I am getting opt1 as my output.

When i give validate All test cases are passed but when i give Submit the page is loading for a long time. It is not getting submitted.

May I know Why?

Comments
Please login to comment.
 
Powered by habitate.io Habitate