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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:14:13+00:00 2026-06-10T23:14:13+00:00

Only on Firefox do I get this error: Element referenced by ID/NAME in the

  • 0

Only on Firefox do I get this error:

Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.

if (c.checked == 1)

GFPart...vitate= (line 17)

TypeError: c is null

if (c.checked == 1)

My Javascript look like this:

<script type="text/javascript">
    function SavePartners() {
        var poz = '@ViewBag.Activity';
        var rowCount = dataTable.rows.length;
        var ala0 = "";
        for (var i = 1; i < rowCount; i++) {
            var c = document.getElementById("chkpart" + i);
            if (c.checked == 1)
                ala0 += dataTable.rows[i].cells[1].innerText + "^";
            var ala = ala0.substring(0, ala0.length - 1);
        }
    $.ajax({
        url: '@Url.Action("TPartners")',
        data: { pozActivitate: poz, listapart: ala },
        dataType: "Json",
        type: "POST",
        error: function () {
            alert("Error");
        },
        success: function (data) {
            window.close();
        }
    });
}

My HTML look like this (its a table with 2 columns, 1 with Checkbox and 2 with the Name of the partner)

        <tr>
            <td style="border-left: none;">
                @if (listaDeTest.Activity!= 0)
                {
                    string x = (from a in listaDeTest.PartenerName
                                where a == s
                                select a).FirstOrDefault();
                    if (x == null)
                    {
                    <input type="checkbox" name="chkpart @i" />
                    }
                    else
                    {
                    <input type="checkbox" name="chkpart @i"  checked="checked"/>                         
                    }
                }
                else
                {
                    <input type="checkbox" name="chkpart @i" />
                }
            </td>
            <td>
                <p style="margin-left: 5px;">@s</p>
            </td>
        </tr> 

….
at then end a have a button with onclick function.
Any ideas what might be? Because in IE works perfectly. Thanks in advance

  • 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-10T23:14:15+00:00Added an answer on June 10, 2026 at 11:14 pm

    Internet Explorer and Chrome automatically make global variables for DOM elements with “id” values. Firefox doesn’t, because no standard says it should (and it’s a goofy idea anyway).

    Thus, in Internet Explorer, having an HTML tag on the page like this:

    <div id='container'>
       ...
    </div>
    

    means that you’ve also got a global variable (a window property) called “container”, with its value being a reference to the DOM element for that <div>. In Firefox, you don’t. You have to call

    var container = document.getElementById('container');
    

    to get a reference to the DOM element.

    It’s not clear in your code what reference Firefox is complaining about; I suspect it’s “dataTable”, which I’m guessing is the id of the <table>. You didn’t post that however so I’m not sure.

    edit — oh, and another thing: Internet Explorer, for reasons unknown, returns elements from the .getElementById() call based on element name. That erroneous behavior is not copied by Firefox or other browsers. Your input elements have a “name” attribute but no “id”.

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

Sidebar

Related Questions

I get this error only in safari and the android browser. All my code
I like to get window pid (only firefox) from wmctrl, i tried wmctrl -lp
this issue is kinda strange, and happens only in Firefox (v. 3.6.6 but also
My code works fine in firefox but in Chrome I get an error. It's
I get the following error in IE 9 SCRIPT5009: 'JSON' is undefined only when
what's weird about my error is that it ONLY occurs in the firefox extension
In Firefox only, if I highlight text and drop it into the middle of
I have a problem with my jquery UI tabs currently only in Firefox 3.6.24
How can I hide a div with javascript if the browser is firefox only?
Firstly, when I say other browsers I really only mean Firefox because that's all

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.