0

I have a select which doesn't show 'Default' option. It looks like this:

<select id="sortBy" name="sortBy" onchange="if(guestLightbox()) {sortPropertyBy(this.value);}">
<option class="quality_score_member hideWhenResaleMLS" value="quality_score_member-desc">Default</option>
<option class="auction_date hideWhenForeclosures hideWhenPreForeclosures hideWhenResaleMLS hideWhenFSBOOrRentalOrRTO" value="auction_date">Auction Date</option>
<option class="home_score-desc" value="home_score-desc">SmartZip HomeScore</option>
<option class="investor_score-desc" value="investor_score-desc">SmartZip InvestorScore</option>
<option class="amount" value="amount">Price (low to high)</option>
<option class="amount-desc" value="amount-desc">Price (high to low)</option>
<option class="living_area_square_feet" value="living_area_square_feet">Square Feet (low to high)</option>
<option class="living_area_square_feet-desc" value="living_area_square_feet-desc">Square Feet (high to low)</option>
<option class="scrape_date-desc" value="scrape_date-desc">Most Recent</option>
<option class="sale_type" value="sale_type">Sale Type</option>
<option class="property_record_type" value="property_record_type">Property Type</option>
</select>

Could somebody explain why?

Thanks.

4
  • What do the CSS classes quality_score_member hideWhenResaleMLS contain? Commented Mar 7, 2012 at 11:12
  • that class actually doesn't exists. Commented Mar 7, 2012 at 11:28
  • you were right it is because of the class but dont know why. Commented Mar 7, 2012 at 11:35
  • sorry bro I tried but it doen't allow me to accept it anymore. will do it next time :) Commented Mar 8, 2012 at 21:28

4 Answers 4

2

The only reason I can see for this is one of your CSS classes

quality_score_member hideWhenResaleMLS

defining a display: none, visibility: hidden, or some other element-hiding CSS property.

Edit: turns out it's jQuery removing the option. Well, that was the other only possible reason ;)

Sign up to request clarification or add additional context in comments.

3 Comments

When I am viewing in Elements section of Google Chrome that element is just excluded.
just doesn't appear. I found where it comes from $('.hideWhen${saleCategoryType}').remove(); thanks you where right
@George that's the reason then. Why that is in your code, I don't know - I'm sure it has a purpose
1

I have seen this error quite a few times when someone is developing a page and refreshing to see the updates. Your browser will usually display whatever option you had selected last. This includes if you add an option above or below the previously selected option.

Try going to the page again from scratch (not using refresh) and tell us if that solves your problem.

1 Comment

no no that's not an issue. In fact, there are several different tabs that consume this HTML and only one of them is not displaying the first option.
0

Try the attribute SELECTED (or, respectively, selected='selected' or alike [upd]) with OPTION.

Comments

0

Working here on Jsfiddle

<select id="sortBy" name="sortBy" onchange="if(guestLightbox()) {sortPropertyBy(this.value);}">
    <option class="quality_score_member hideWhenResaleMLS" value="quality_score_member-desc">Default</option>
    <option class="auction_date hideWhenForeclosures hideWhenPreForeclosures hideWhenResaleMLS hideWhenFSBOOrRentalOrRTO" value="auction_date">Auction Date</option>
    <option class="home_score-desc" value="home_score-desc">SmartZip HomeScore</option>
    <option class="investor_score-desc" value="investor_score-desc">SmartZip InvestorScore</option>
    <option class="amount" value="amount">Price (low to high)</option>
    <option class="amount-desc" value="amount-desc">Price (high to low)</option>
    <option class="living_area_square_feet" value="living_area_square_feet">Square Feet (low to high)</option>
    <option class="living_area_square_feet-desc" value="living_area_square_feet-desc">Square Feet (high to low)</option>
    <option class="scrape_date-desc" value="scrape_date-desc">Most Recent</option>
    <option class="sale_type" value="sale_type">Sale Type</option>
    <option class="property_record_type" value="property_record_type">Property Type</option>
</select>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.