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 8347177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:16:53+00:00 2026-06-09T07:16:53+00:00

Problem This is hard to explain, so please bear with me. I came across

  • 0

Problem

This is hard to explain, so please bear with me. I came across a curious scenario today that I solved, but I’m not sure why my solution works.

I created a group of selects and wrote a script that constrains you from selecting the same option more than once by removing the selected option from the other select lists.

However in IE(including IE9), the option list was displaying the wrong option, but once selected it would display the right option.

enter image description here

Re-create the error

In my first script you can get to this state by doing the following:

NOTE: This is IE only. Works fine in Chrome

Script: http://jsfiddle.net/s6F4h/37/

  1. In the first drop down choose 3
  2. In the second drop down choose 1
  3. In the first drop down choose 1 (should not be an available option)
  4. Notice that the selected value is 2!
  5. Notice that changing your selected value in the second drop down also produces different values than those presented.
  6. Lastly, notice that the DOM is displaying the correct values
    enter image description here

Fix the error (magically)

Now for my fix which I found by random guess work…

Script: http://jsfiddle.net/s6F4h/36/

Creating my selects like this causes the strange behavior:

var $S1 = $('<select class="question" />'); 

Creating my selects like this corrects that behavior:

var $S1 = $('<select />', {'class': 'question'}); 

Follow Up

  • What is the difference in the above two jQuery objects?
  • How in the world can IE show one thing in its DOM and another on the actual page (I know CSS content can do this, but there’s no CSS involved)? Wouldn’t be so bad if this was just an IE6-8 thing, but it’s reproducible in IE9!
  • Could it be an IE bug or a jQuery bug?

Lastly, maybe I’ve just done something incredibly stupid, and in my hysteria have concocted some absurd conclusion. Please, gently, inform me if I have done so.

  • 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-06-09T07:16:55+00:00Added an answer on June 9, 2026 at 7:16 am

    The difference between the two DOM objects is not a matter of data, but rather a matter of the order of operations when they are created.

    When you use the inline of $('<select class="blah" />'), the <select> element is created with the class already intact, and styled accordingly. When you use $(<select />, { ‘class’: ‘blah’ })`, you perform 2 operations: 1) create the item, 2) set it’s class.

    This seems innocuous, but it actually forces the browser to do a redraw of the element upon application of the CSS class.

    Now – in your scenario, the fact that this causes the specific issue that it does is pretty clearly a bug that applies to IE – but the fact that IE shouldn’t behave poorly obviously in no way prevents it from doing so.

    Hope this sheds some light.

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

Sidebar

Related Questions

I got this small problem but I find it hard to explain so bear
This problem is going to be hard for me to explain but I will
This is hard to explain but hopefully I can articulate my problem well enough.
This question is hard to explain so please bear with me. I have a
Problem This question actually came up at work today. We are planning an experiment
It's hard to explain in a single line, my problem is that I need
Here's a problem that is kinda hard to explain. So here's an example. Let's
I'm having a hard time describing this problem. Maybe that's why I'm having a
This is hard to explain but if you go here: https://developers.facebook.com/docs/reference/api/ You will see
Ok this is a little hard to explain but here I go. On View1

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.