TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Robbie Hegarty
NA
51
0
Retrieving selected string from a combobox
Jan 21 2019 2:37 AM
Hi folks
I've written this little snippet to help simplify my question. Basically, on the combobox change I'm displaying the value of the selection - so 21 if I select BMW. How could I display BMW instead?
<select id="myWeeCombo" onchange="myFunction()">
<option value="11">Audi</option>
<option value="21">BMW</option>
<option value="31">Mercedes</option>
<option value="41">Volvo</option>
</select>
<p id="demo"></p>
<script>
function myFunction()
{
var x = document.getElementById("myWeeCombo").value;
document.getElementById("demo").innerHTML = "You selected: " + x;
}
</script>
Reply
Answers (
5
)
How to Enable/Disable Href link at code behind
How to Convert a String in a FOR Loop