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();


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

Published by


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