for example I have this html code:

    <select id="mySelect">
            <option value="0">apple</option>
            <option value="1">orange</option>
            <option value="2">banana</option>
            <option value="3">tomato</option>
        </select>

1-how can I select <option value="2">banana</option>
(by passing the value attribute to selector function)then click on it with javascript with out using jquery
2-Is there any way to select this just by passing apple to selector function with out passing the value?

$( "#myselect option:selected" ).text();
$( "#myselect option:selected" ).val();
$( "#myselect option:selected" ).click(function (){
 ur code
});
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.