I select the option label with scrollbar to view the contents of the dropdown list. I want that when we click to select an item, the scrollbar should be at the bottom.
jquery code $('document').ready(function(){ $('#textin1').click(function() { var pos = $('#textin1').offset(); pos.top += $('#textin1').width(); $('#dropdown').fadeIn(100); $('#dropdown').scrollTop($('#dropdown').find('li:contains("'+$('#textin1').val()+'")').position().top); return false; }); $('#dropdown li').click(function() { $('#textin1').val($(this).text()); $('#dropdown li').removeClass('selected'); $(this).addClass('selected'); $(this).parent().fadeOut(100); }); });
Try this maybe it will work for you