select a value from drop down in HTML code example

Example 1: How to select a value in a dropdown

How do you handle Select type of dropdown?
    - If it is  web element.
    -> return type: List

Example 2: selected dropdown value

Plain JavaScript:
===================
var e = document.getElementById("elementId");
var value = e.options[e.selectedIndex].value;
var text = e.options[e.selectedIndex].text;
---------------------------------------------------------
jQuery:
=======
$("#elementId :selected").text(); // The text content of the selected option
$("#elementId :selected").val(); // The value of the selected option

Tags:

Misc Example