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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:09:37+00:00 2026-05-13T08:09:37+00:00

Hi this is an example of my code. I want to get the margin-top

  • 0

Hi this is an example of my code. I want to get the margin-top from all the “divs” contained in the div appointmentContainer.

<div class="appointmentContainer">
    <div style="width: 940px; z-index: 8; background-color: yellow; position: absolute; margin-top: 0px;" class="a_162">
        <a id="a_162" class="appointments">414<br/></a>
    </div>
    <div style="width: 940px; z-index: 8; background-color: yellow; position: absolute; margin-top: 15px;" class="a_164">
        <a id="a_164" class="appointments">aaaa<br/></a>
    </div>
</div>

so I have something like ths and I want to find the margin-top’s in both of the above divs.

So so far I have this

$('#a_162').parents('div:eq(0)').children('a');

So thats what I have so far. I want to find all the anchor tags from that parent div what is appointmentcontainer and get a list of all the margin-tops.

So I would like a list like

margin-top : 0
margin-top: 15

or

0
15
  • 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-13T08:09:38+00:00Added an answer on May 13, 2026 at 8:09 am

    Your question is a bit unclear, but this will get all the margin-tops of divs inside .appointmentContainer which has a link with ID of #a_162:

    var margin_tops = [];
    $('#a_162').closest('.appointmentContainer').find('div').each(function() {
        margin_tops.push($(this).css('margin-top'));
    });
    
    alert(margin_tops.join("\n"));
    

    What I don’t understand is why you tried to select the a elements as the margin-top was applied to the div element?

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

Sidebar

Related Questions

I have code like this: <div id=item-menu> <ul style=padding-top: 10px; padding-left: 20px;> <li id=item-1>1</li>
With regards this example from Code Complete: Comparison Compare(int value1, int value2) { if
This is an example code from the prototype site. var url = '/proxy?url=' +
Is there anyway I can modify this code example #include <stdlib.h> #include <iostream> class
I want to understand the example from msdn ( http://msdn.microsoft.com/en-us/library/ms742521.aspx#defining_simple_datatemplate ). XAML Code: <ListBox
In this example code, I have a reference to ksoap2-android-assembly-2.6.3-jar-with-dependencies its incredible when do
Take this example code (ignore it being horribly inefficient for the moment) let listToString
In this example code, I'm trying to offset the Grid 's Canvas position by
In this example code it deals with framebuffers before setting up the context. I've
I am going through a tutorial, and it showed this example code to make

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.