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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:49:27+00:00 2026-06-11T05:49:27+00:00

I have some mark up like this: <div id=columns> <ul id=column1 class=column> <li class=widget

  • 0

I have some mark up like this:

<div id="columns">

    <ul id="column1" class="column">
        <li class="widget color-green" id="intro">
            <div class="widget-head">
                <h3>Introduction Widget</h3>
                <span class="spanColumnId"></span>
                <span class="spanColumnNumber"></span>
            </div>
            <div class="widget-content">
                <div align="center">
                    <asp:Chart ID="chtBarTest" runat="server" CssClass="imgOpa" Width="620px">
                        <Series>
                            <asp:Series Name="chBar" ChartType="Area" Palette="Fire" ChartArea="MainChartArea">
                            </asp:Series>
                        </Series>
                        <ChartAreas>
                            <asp:ChartArea Name="MainChartArea" Area3DStyle-Enable3D="true">
                            </asp:ChartArea>
                        </ChartAreas>
                    </asp:Chart>
                </div>
            </div>
        </li>
        <li class="widget color-red">  
            <div class="widget-head">
                <h3>Widget title</h3>
                <span class="spanColumnId"></span>
                <span class="spanColumnNumber"></span>
            </div>
            <div class="widget-content">
                <asp:Chart ID="chPieTickets" runat="server" Width="620px" CssClass="imgOpa">
                <Series>
                    <asp:Series Name="srTickets" ChartType="Pie" Palette="Pastel" ChartArea="PieChartArea">
                    </asp:Series>
                </Series>
                <ChartAreas>
                    <asp:ChartArea Name="PieChartArea" Area3DStyle-Enable3D="true">
                    </asp:ChartArea>
                </ChartAreas>
            </asp:Chart>
            </div>
        </li>
    </ul>

    <ul id="column2" class="column">
        <li class="widget color-blue">  
            <div class="widget-head">
                <h3>Widget title</h3>
                <span class="spanColumnId"></span>
                <span class="spanColumnNumber"></span>
            </div>
            <div class="widget-content">
                 <asp:Chart ID="chartUserActivity" runat="server" Width="620px" CssClass="imgOpa">
                <Series>
                    <asp:Series Name="stUserActivity" ChartType="Area" Palette="Pastel" ChartArea="UserActivityArea">
                    </asp:Series>
                </Series>
                <ChartAreas>
                    <asp:ChartArea Name="UserActivityArea" Area3DStyle-Enable3D="true">
                    </asp:ChartArea>
                </ChartAreas>
            </asp:Chart>
            </div>
        </li>
        <li class="widget color-yellow">  
            <div class="widget-head">
                <h3>Widget title</h3>
                <span class="spanColumnId"></span>
                <span class="spanColumnNumber"></span>
            </div>
            <div class="widget-content">
                <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam magna sem, fringilla in, commodo a, rutrum ut, massa. Donec id nibh eu dui auctor tempor. Morbi laoreet eleifend dolor. Suspendisse pede odio, accumsan vitae, auctor non, suscipit at, ipsum. Cras varius sapien vel lectus.</p>
            </div>
        </li>
    </ul>
</div>

Each of these list items will eventually be filled with a chart control as a dashboard. I am trying to fill in the “spanColumnNumber” with the index of the li item in the list, but I am having a difficult time. Here is my jQuery mark up

$(".column").each(function () {
       var id = $(this).attr("id");
       $(this).find(".spanColumnId").append($(this).attr("id"));
       $(this).find(".spanColumnNumber").append($("#"+id).index("li"));
});

This works fine to get me the id, however I cannot get the index for some reason, I have tried every way imaginable (in my mind).

  • 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-11T05:49:29+00:00Added an answer on June 11, 2026 at 5:49 am

    It’s hard to work out exactly what you want (and like Konstantin said, use .text() instead of .append()), but I think this should solve your issue:

    $(".column").each(function () {
          var id = $(this).attr("id");
          $(this).find(".spanColumnId").text($(this).attr("id"));      
          $(this).find(".spanColumnNumber").each(function() {
              $(this).text($(this).closest('li').index());
          });
    });​
    

    Assuming you want the column number to be the index of the li and not the ul?

    http://jsfiddle.net/Yr3k7/1/

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

Sidebar

Related Questions

I have some mark-up like so: <div class=slideshow> <div class=slide style=display:block;></div> <div class=slide style=display:none;></div>
I have @hash that looks like this: [1, {:clid=>1, :nvz=>4, :tip=>IP, :name=>Mark, :record=>some text}]
I have several div elements like this: <div class=newsContainer> <div class=deleteBoxIcon> <img alt=Delete src=close_mark.png>
I have this mark-up: <div> TEXT <a class=toggle-action> TOGGLE </a></div> <dl class=collapsed> ... </dl>
I have a string like this: Heading Some interesting text here HeadingSome interesting text
In my application I have a mark up like these <div id=divLeft style =
For some complicated reason, I need to mark some Javascript as special, like this:
I have a simple menu that looks like this: <ul class=menu> <li class=active><a href=<%=
I have the following string: <h1 class=title>This is some heading?</h1><h2 class=desc>Here is the description
my problem is: I have an image and want to mark some areas over

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.