Note that there are some explanatory texts on larger screens.

plurals
  1. POChrome not displaying dropdown correctly
    primarykey
    data
    text
    <p><img src="https://i.stack.imgur.com/f9Owr.jpg" alt="Chrome dropdown"></p> <p>I have a dependent drop down box just like country/state/city in my code. When I select a certain item on the 1st drop down, items get filtered in the consecutive dropdown using jQuery. However, on certain selections in the first drop down, the consecutive drop down gets a scrollbar even though it has only 3 items to display.</p> <p>This does not happen on all selections from the first dropdown but only certain selections. When i take a look at the source code from chrome after the page has loaded, everything seems to be fine.</p> <p>This works fine in firefox so i'm assuming my code is right or maybe im wrong. </p> <p>Any suggestions?</p> <pre><code>&lt;script&gt; $(document).ready(function() { $(".mycountry").change(function () { var id = $(this).find(":selected").attr("id"); $(".state").each(function(idx, state) { if ($(state).hasClass(id)) { $(state).show(); } else { $(state).hide(); } }); }); }); &lt;/script&gt; &lt;?php $countrystring = ""; $statestring = ""; $sql = "SELECT countryid, countryname FROM country_info ORDER BY countryname"; $result = mysql_query($sql, $conn); while ($ref = mysql_fetch_row($result)) { $countryid = $ref[0]; $countryname = $ref[1]; $countrystring = $countrystring . "&lt;option class=\"country\" id=\"$countryname\" value=\"$countryid\"&gt;$countryname&lt;/option&gt;\n"; $iisql = "SELECT stateid, statename FROM state_info WHERE countryid=$ref[0]"; $iiresult = mysql_query($iisql, $conn); while ($iiref = mysql_fetch_row($iiresult)) { $statename = $iiref[1]; $stateid = $iiref[0]; $statestring = $statestring . "&lt;option class=\"$countrystring state\" value=\"$stateid\"&gt;$iiref[1]&lt;br&gt;&lt;/option&gt;\n"; } } ?&gt; &lt;b class="fsheader"&gt;Country:&lt;/b&gt;&lt;br&gt; Choose a Country:&lt;br&gt; &lt;select name="countryid" class="mycountry" id="countryid"&gt; &lt;option value="-1" disabled="" selected&gt;- Select Country -&lt;/option&gt; &lt;?php echo $countrystring ?&gt; &lt;/select&gt; &lt;?php print("$tdc$tdo\n"); ?&gt; State:&lt;br&gt; &lt;b class="fsheader"&gt;Choose a State:&lt;/b&gt;&lt;br&gt; &lt;select name="stateid" class="mystate" id="stateid"&gt; &lt;option value="-1" disabled="" selected&gt;- Select State -&lt;/option&gt; &lt;?php echo $statestring ?&gt; &lt;/select&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload