Hi this is giri
i need ur help that is
i am trying to select two drop down option in html and i want compare to options if those options are equal than it as two redirect to respective page ,will u please provide with a code .
thank you

ready done!

<select id="select_one" onchange="selection_changed();">
<option value="1">one</option>
<option value="2">two</option>
</select>

<select id="select_two" onchange="selection_changed();">
<option value="1">one</option>
<option value="2">two</option>
</select>

selection_changed(){
if( $("select_one").val()==$("select_two").val(){
    window.location="http://example.com";
}
}

@TextWiller, you forgot the '#' on the jQuery selectors.
But since you're using jQuery, I think this is better:

    <select class="whatched_select" >
    <option value="1">one</option>
    <option value="2">two</option>
    </select>
    <select class="whatched_select" >
    <option value="1">one</option>
    <option value="2">two</option>
    </select>
    <script type="text/javascript">
    $(function() {
        var $selects = $(".whatched_select");
        $selects.change(function() {
            if ( $selects.eq(0).val() == $selects.eq(1).val() ) {
                window.location = "http://redirectpage.com.br";
            }
        });
    });
    </script>

@ AleMonteiro
I can agree with you, I have choosen that way because I often work together with web designers
They are accustomed to change classes and ids . if they see there is an event in html they understand something is going on that item
Moreover when javascript is in an attched file

They are accustomed to change classes and ids . if they see there is an event in html they understand something is going on that item

It's best practice to separating out any JavaScript behavior code from your markup and presentation. It's called unobstrusive JavaScript. If you work with web designers then you could decouple your JavaScript classes from the CSS ones by using a prefix.

<button class="btn js-popup">click here</button>

Like this, web designers know that the btn class is for styling and (other) JavaScript developers know the js-popup class is for behavior.

commented: Nice idea! +10
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.