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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:48:14+00:00 2026-05-31T05:48:14+00:00

I have an anchor tag on an ASP.NET page, whose text (inner HTML) I

  • 0

I have an anchor tag on an ASP.NET page, whose text (inner HTML) I wish to populate, through JavaScript, with an integer retrieved from a Web Service.

I tried this using the following:

HTML:

<script type="text/javascript">
    $(function () {
        GetEntityCount([{ domId: document.getElementById("entityCountIndicator")}]);
    });
</script>

<a id="entityCountIndicator"></a>

JavaScript:

function GetEntityCount(domId) {
    $.ajax({
        type: 'POST',
        url: webServiceProxy + '/GetEntityCount',
        cache: true,
        success: function (xml) { GotEntityCount($(xml).text(), domId); }
    });
}

function GotEntityCount(entityCount, domElement) {
    if (isNaN(entityCount)) return;
    domElement.innerHTML = entityCount.toString();
}

but it did not work.

After examining the variables in FireBug, and doing a bit of experimentation I managed to get it working by changing the line that sets the innerHTML to:

domElement[0].domId.innerHTML = entityCount.toString();

This seemed to do the trick, but I have no idea why it is working or what is happening here.

Why is the document.getElementById(“entityCountIndicator”) call apparently returning an array, rather than a single element? And why do I then have to probe the first element of that array and set innerHTML on its domId property?

  • 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-31T05:48:15+00:00Added an answer on May 31, 2026 at 5:48 am

    Because your are passing an array in

    [{ domId: document.getElementById("entityCountIndicator")}]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an ASP.Net page in which I have an html anchor tag and
I have an anchor tag in my HTML that is used for a javascript
I have an anchor tag on my web page that is currently defined as:
I have a C# ASP.NET app that creates a JavaScript array of values for
I have an anchor tag on my page, I want an event attached to
I have an anchor tag with text and I want to check if the
I have an ASP.net WebForms page that has a lot of content on the
In ASP.NET MVC I see I have handy HTML helpers that I can use
I have anchor tag inside a gridview which im using javascript onclick to popup
I have an anchor tag in my .aspx page. I want to add a

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.