Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to create a quick jump menu with jQuery

DZone's Guide to

How to create a quick jump menu with jQuery

· Web Dev Zone
Free Resource

Try RAD Studio for FREE!  It’s the fastest way to develop cross-platform Native Apps with flexible Cloud services and broad IoT connectivity. Start Your Trial Today!

How to create a quick jump menu with jQuery This is part of my snippets library at https://github.com/lordspace/snippets/tree/master/js/quick_jump

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>    
<script type="text/javascript" charset="utf-8">
//<![CDATA[
    $(document).ready(function() {
        $('.site_quick_jump').change(function(){
            // option 1 use a JS redirect in the current window
            //window.location.href = $(this).val();
            
            // option 2; set the 'action' of the form and submit it
            if ($(this).val() != '') {
                $('#site_quick_jump_form').attr('action', $(this).val()); // 
                $('#site_quick_jump_form').attr('target', '_blank'); // new window
                $('#site_quick_jump_form').submit(); // Go!
            }
        });
    }); // doc ready
//]]>
</script>    
    
<div class="site_quick_jump_container">
    <form id="site_quick_jump_form" method="get" action="">
    Go to: <select class="site_quick_jump">
                <option></option>
                <option value="http://yahoo.com">Yahoo!</option>
                <option value="/product1.html">Product 1</option>
                <option value="/product2.html">Product 2</option>
           </select>
    </form>
</div>

From http://www.devcha.com/2011/08/how-to-create-quick-jump-menu-with.html

Get Your Apps to Customers 5X Faster with RAD Studio. Brought to you in partnership with Embarcadero.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}