onclick event change url using jQuery

<script type="text/javascript" src="jquery-1.6.4.min.js"></script>
<script type='text/javascript'>
    $(document).ready(function() {
        $("input:button").click(function() {
            location.href = $("#urllist option:selected").val();
        });
    }); 

</script>

URL:
<select id='urllist'>
    <option value='http://www.google.com'>google</option>
    <option value='http://localhost'>localhost</option>
    <option 
      value='http://forum.jquery.com/topic/onclick-event-change-url-using-jquery' 
      selected>source</option>
</select>
    <input type="button" value="Go" />
</select>
onclick event change url using jQuery

Published by

G3n1k

just to remember what i had known :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s