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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:14:07+00:00 2026-06-07T09:14:07+00:00

I really can’t figure out how I would do this. It’s more of a

  • 0

I really can’t figure out how I would do this. It’s more of a concept question than a code question so I’ll just post an example:

object = $('#div');

function doSomething(object) {
    //iterates through a list and creates a UL with items in corresponding to that list.
    $(body).append("<li id='clickme'>Hello world</li>");
}

function createModal(object) {
    //creates modal dialogue.
    doSomething(object);
    //more stuff
}

$('#clickme').live("click", function() {
    //I need access to object (not the object declared at first,
    //the object passed into doSomething) here.

});

Any ideas how I would do such a thing? doSomething would create a set of LIs and have a parameter passed into it. When those LIs the function creates are clicked, they need to interact with the parameter that’s passed into doSomething. Is there a way to bind them or something?

Sorry if I didn’t make any sense.

  • 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-07T09:14:09+00:00Added an answer on June 7, 2026 at 9:14 am

    You can use jquery data function to associate data to your DOM elements. You then can read those data when handling events.

    An alternate way, generally not recommended but useful when you build your html in one big pass and don’t have an easy access to the DOM elements, and only have strings (or keys), is to add an attribute and retrieve it later using jquery’s attr function. Whenever possible I recommend you to use the data function though.

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

Sidebar

Related Questions

I'm pulling my hair our here and really can't figure out why this code
This is really a stupid question.. I really can't figure this out so need
I have a weird issue with my CSS. Really can't figure this one out.
I really can't figure this one out. I've read a lot of similar problems
I really can't figure out why this JPanel p isn't appearing? I thought I
I really can't figure out why my code isn't working because Twilio's debugger isnt
I really can't figure out what's going on in this case. On the multiline
I really can't figure this one out... I'm trying to achieve the following result
my question is really basic but I really can't figure out how to do
This API gives me a headache.. Really can't figure out what is wrong here..

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.