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

  • Home
  • SEARCH
  • 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 6925123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:44:57+00:00 2026-05-27T10:44:57+00:00

I’m having problems to make the same web apps work for different versions of

  • 0

I’m having problems to make the same web apps work for different versions of Firefox :

var col = [{'id': 'id1'}, {'id': 'id2'}, {'id': 'id3'},{'id': 'id4'},
                {'id': 'id5'}, {'id': 'id6'}, {'id': 'id7'}, {'id': 'id8'}];
doSomething(col);

if id5 doesn’t exist my page displays fine in FF8 but in FF 3.5 its not the case.

Is there a way to report or test when an id doesn’t exist and display its name (because even in browser console it doesn’t display which id is ) ?

EDIT

var col = [{'id': 'id1'}, {'id': 'id2'}, {'id': 'id3'},{'id': 'id4'},
                    {'id': 'id5'}, {'id': 'id6'}, {'id': 'id7'}, {'id': 'id8'}];
     YAHOO.util.Dom.batch(col, desactivateBtn );

    var desactivateBtn = function(btn){
            YAHOO.widget.Button.getButton(btn.id)._setDisabled(true);
    };

I’m using YUI and YAHOO.util.Dom.batch is just so that it applies desactivateBtn on all buttons with the ids in col (it’s similar to jQuery’s $.each method)

Thanks

  • 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-27T10:44:58+00:00Added an answer on May 27, 2026 at 10:44 am

    You’re trying to access a property or method on an element that isn’t found.

    Change:

     var desactivateBtn = function(btn){
           YAHOO.widget.Button.getButton(btn.id)._setDisabled(true);
       };
    

    To:

     var desactivateBtn = function(btn){
           var elem = YAHOO.widget.Button.getButton(btn.id);
           if(elem) elem._setDisabled(true);
       };
    

    I’ve encountered a similar problem with IE swallowing what other browsers would consider an exception. The problem stemmed from using eval (it was legacy code, not written by me). I haven’t looked at YAHOO’s library, but I wonder if the getButton method uses eval internally?

    edit: If you want to display which items are missing, there’s no easy way to do this across browsers since IE8 doesn’t have console.log. You could choose to write the output to a debug div element or alert with the message. I’d probably go with the debug div element.

    var DEBUG = true;
    window.DEBUG_OUTPUT = null;
    
    if(DEBUG) {
       window.DEBUG_OUTPUT = /* create div, append to whatever element */
    }
    

    Then, you can modify your function to something like:

    var desactivateBtn = function(btn){
        var elem = YAHOO.widget.Button.getButton(btn.id);
        if(elem) { elem._setDisabled(true); }
        else { window.DEBUG_OUTPUT.innerHTML = window.DEBUG_OUTPUT.innerHTML + ('' + btn.id);
    };
    

    A couple things to note:

    1. I don’t like adding to the window object, but for console/debug I think it’s alright.
    2. I have ('' + btn.id) to coerce non-string ids (like 1, 2, etc.) to strings. I’m not sure if this is a problem any more, but I encountered a bug long ago in some browser that setting innerHTML = 3 would cause an error since 3 isn’t a string. I haven’t had time to test if this is still a problem in any of the major browsers.

    edit2: even better, wrap the btn.id in <p></p> tags.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.