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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:33:11+00:00 2026-06-11T00:33:11+00:00

I have different container that get reloaded on different events. I have plenty of

  • 0

I have different container that get reloaded on different events. I have plenty of them, so I gave each container the class load.

This is how all of them look like:

<div class="load" data-href="facebook">
</div>

I also have a function, that is triggered by various actions:

function get_timing(time)
{
   $(".load").load("myfolder/mod_"+$(this).attr("data-href")+".php?action="+time, function() { 
       alert('Here I could use this:' + $(this).attr("data-href"));
   }
}

I know that I cannot use this in the example above, I could only use it in the callback. My question is: How can I use attributes of the object to define the path of the load function.

This is how it could work:

function get_timing(time)
{
   $(".load").fadeIn(10, function()
       {
           $(this).load("myfolder/mod_"+$(this).attr("data-href")+".php?action="+time, function() { 
           alert('loaded');
       }
   }
}

Is there a way to do this without the asynchronus function (in this case .fadIn) around)

Hope I could explain my problem – thank you 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-11T00:33:13+00:00Added an answer on June 11, 2026 at 12:33 am

    If you want to go along with classes you can reference them via an index:

    var element = $(".load").get(0);
    console.log($(element).attr("data-href"));
    

    Note that you have to re-jQueryfy element via $(element) in order to access attr()

    If you want to read out all elements with a given class I recommend $.each()

    //$.each($(".load"), function(index, value){
    $(".load").each(function(index, value){
        console.log( $(value).attr("data-href"));   
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have two text files that each contain different information about certain structures.The
Hi i have a class which contains different methods for checking database values. Each
I want to have an inner div that sites inside different sized container divs,
What am I doing: I have a container class named Os , that can
I have some XML files that contain different function information. I am trying to
I have a folder that contains many different files: folder1: somthing.php somthingelse.php blah.php ect
I have a UITableViewCell that contains a UIScrollView . The UIScrollView contains a different
I have a struct-array that contains details of different reports that can be run.
This question is in continuation to How to get attributes of container in jQuery
So I have a class that is a generic and it may need to,

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.