dropdown on change scroll to specific id

jquery

Solution

$('select').on('change', function(){
    $('body, html').animate({ scrollTop: $('#' + $(this).val()).position().top });
});

Working demo http://jsfiddle.net/gcXM7/1/

Though, in case it's not obvious, you might want to give your select an id

<select id="foo">

and select only that one

$('#foo').on('change', ...

Problem

I have an Dropdown with more than 100 option. I want to scroll to div when selecting option to same id matching with option value. any help will be highly appreciated. ``` <select> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <div id="a"></div> <div id="b"></div> <div id="c"></div> ```

Original source