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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:39:46+00:00 2026-05-23T06:39:46+00:00

Is this considered to be a JS bug in IE? Please check the following

  • 0

Is this considered to be a JS bug in IE?

Please check the following function

function select_deselect_all_items(status)
    {
        select_deselect_items_under_panel(status, $('myPanel'));

        panel = $('myPanel');
        var items = panel.getElementsByTagName('input');
        for (var n = 0; n < items.length; n++) {
            item = items[n];
            if (item.id.substr(0, 10) == 'myItems_') {
                item.checked = status;
                select_deselect_items_under_panel(status, $('myPanel'));
            }
        }
    }

Now, this works fine in FF and Chrome, but generate an error in IE. Error is the following:

Error: Unable to get value of the property 'substr': object is null or undefined

I have this function in several places throughout my code (haven’t placed it into one js file, unfortunately) and I’ve already stumbled on this issue. The problem seems to be with item variable. If this is changed to something else, i.e. myWildVarName, things seem to work ok. I debugged the page in IE, and I see that item is an object with certain properties…

So, a bug or a rookie mistake?

Cheers

  • 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-23T06:39:47+00:00Added an answer on May 23, 2026 at 6:39 am

    You do have a mistake in your code, in that you never declare the item variable and thus fall prey to the Horror of Implicit Globals.

    My guess is that you have something on your page that has either the name or id “item”, and so that’s becoming a property of window because IE does that (and many other browsers have followed suit). As you probably know, properties of window are globals, and so when you try to assign to the item symbol in your function, you’re assigning to that global property. Depending on what item is, IE may be trying to apply “don’t actually assign to the object, but assign to its default property instead” logic (because it’s allowed to do that if it wants to with host objects) and running into an issue.

    Declare your local variable (always a good idea) and the problem should go away.


    Update: Now that you’ve posted the actual error, the rationale above for what’s happening may not be spot-on, on but the recommendation (declare the local) remains the same. 🙂

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

Sidebar

Related Questions

Is this an intended behavior or is it a bug? Consider the following trait
This code: const string LabelToFind = goTo considered Harmful; using (var file = new
Assume I have the following example: Example One $('.my_Selector_Selected_More_Than_One_Element').each(function() { $(this).stuff(); $(this).moreStuff(); $(this).otherStuff(); $(this).herStuff();
I'm experiencing something considered a bug in my situation. Probably this is not a
I guess no one will have a definative answer to this but considered predictions
This could be considered a duplicate question, as a similar one has already been
IS this bit of code in PHP/mysql considered a stored procedure? $sql = 'SELECT
[EDIT: this question is about Mozilla Audio Data API which is no longer considered
Is the advice given in this oft-cited MSDN article still considered sound for converting
I'm doing things considered horrible by some lately, but I personally enjoy this kind

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.