Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6778541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:16:41+00:00 2026-05-26T16:16:41+00:00

I have a SELECT element in a web page, and I’d like it to

  • 0

I have a SELECT element in a web page, and I’d like it to load scrolled to the bottom. In most browsers, I can do this:

myselect.scrollTop = myselect.scrollHeight;

Although scrollHeight is out of bounds, the browsers figure that out and limit it appropriately. Except in Google Chrome. I could file a bug report, but that doesn’t help me with my immediate problem. So I tried this:

myselect.scrollTop = myselect.scrollHeight - myselect.clientHeight;

But that subtracted too much — there were items below the bottom of the element. I also tried subtracting offsetHeight, but that was slightly worse.

Does anyone know a browser-agnostic way to properly calculate the scrollTop that is properly in-bounds so it’ll work with Chrome?

BTW, I found this question on stackoverflow: Cross-Browser method for setting ScrollTop of an element?. Perhaps that works for DIVs, but not for SELECT elements and/or not in Chrome.

Thanks!

UPDATE: Here’s an HTML page that demonstrates the problem:

<html>
<head>

<style type="text/css">
.fields9{font-size:15px;height: 180px; width:420px; overflow: auto; border:1px solid #2d2b2d;}
</style>

</head>
<body>

<select multiple="multiple" size="10" id="myselect" class="fields9">
<option>firstone</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>option</option>
<option>lastone</option>
</select>

<script type="text/javascript">

element=document.getElementById("myselect");
//element.scrollTop = element.scrollHeight;
element.scrollTop = element.scrollHeight - element.clientHeight;

</script>

</body>
</html>

If I view this in Chrome, the last option "lastone" is mostly cut off the bottom. BUT, if I remove the class="fields9" attribute, the problem goes away.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:16:42+00:00Added an answer on May 26, 2026 at 4:16 pm

    Get rid of overflow: auto in fields9 declaration to make it work properly in Firefox and Chrome. Here’s working example: http://jsfiddle.net/c4LDv/7/.

    Sadly, I wasn’t able to find any solution for making it work in Opera – apparently you can’t scroll select programatically in Opera…

    Edit: I’ve come up with a hackish approach, using selectedIndex to trigger scrolling to that last option. Check it out here: http://jsfiddle.net/c4LDv/16/ it work in Chrome, Firefox and Opera. However – it won’t scroll down to last option in Opera if one or more option is already selected (on page load) – see it here http://jsfiddle.net/c4LDv/15/ – I wasn’t able to override this behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table. In this table have select element. How can I find
I am creating a web page which will have a Select element with a
I have a html element (like select box input field) in a table. Now
I have this XML: <Test> <element>toto</element> <element>tata</element> </Test> How I can get the nodes
I have a web page with an input field (a calendar to select a
If I have a form like this . <form name=myform action= method=POST> <select name=mydropdown>
I'd like to have a div on my web page that is based off
I have a web page with 2 listboxes (HTML select control). The first listbox
I'm trying to select an element from my webpage... I have inserted a control
I have a select element with a few options. Depending on what is selected,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.