Question Locked

Dropdown list value in javascript

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

My issue is
I am using one dropdown list and user selected value is saved in database...
When user visit that page again,the user selected dropdown list value is automatically selected in dropdown list box.. I know how to retrive from database and stored the selcted value of dropdown list.. I want to know how to user stored dropdown list values automatically seleted.. Please help me.. Give some sample codes..
My code :
var x=document.getElementById("mySelect");
Region=x.options[x.selectedIndex].text;

Here mySelect is a dropdowm list name. I have stored Region value in database..
I retrive the region value when user visit that page again.. But i want to know how i can selected that saved value

3 replies

by mohanagopals

Thanks for reply..
I have retrieved the dropdown list value from database.. That value sotred in a variable named as region. My dropdown list name is mySelect..
I think in ur reply x indicates dropdown list name. Then how can i indicate my selected item which is stored in region..
Code:
var x=document.getElementById("mySelect");
Region=x.options[x.selectedIndex].text;
This code used for stored the dropdown list value in database...
Let me know how ur code is work..
Take care

This discussion is closed to new replies.