0

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?

Edited by Habib_7

3
Contributors
2
Replies
9
Views
2 Years
Discussion Span
Last Post by phoenix254
0
$( "#myselect option:selected" ).text();
$( "#myselect option:selected" ).val();
$( "#myselect option:selected" ).click(function (){
 ur code
});

Edited by phoenix254

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.