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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:13:30+00:00 2026-05-31T15:13:30+00:00

I have a button that creates a new drop pin. That pin is in

  • 0

I have a button that creates a new drop pin. That pin is in a div. It also created a hidden from input to record the position of that pin when it is dragged. In my creation Jquery code I stamp the div for the pin and the input with .data("my_id",pinNumber). PinNumber increments when a new pin is created. This means both the div with the new pin and the input have a data key called my_id with the same value.

When a use clicked delete on a pin, I want it to remove the div and input related to the div. Here’s my delete code.

$(".close").live("click", function() {
  var this_id = $(this).parent("div").data("my_id");
$('div[data:my_id='+this_id+']').remove();

the var this_id is returning the correct pin Id. However I’m running into issues on how to select elements based on data value, not data key.

How do I do this? How would I select all elements or all divs or all inputs, whatever, where data value = a specified value? I’m talking Jquery .data() not HTML data- tags.

PS I’m using live() because these pins are created when the use hits new pin so the DOM element doesn’t exist when the code first goes live. A use could created 30 pins. I need a way, and I think the data() method would work best, for connecting the pin div with the input created. Additionally the .draggable() would then report the UI location to the input with the same data value…. NEED help.

  • 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-31T15:13:31+00:00Added an answer on May 31, 2026 at 3:13 pm

    You can use filter() and check the data value in the predicate you specify:

    $("div, input").filter(function() {
        return $(this).data("my_id") == this_id;
    }).remove();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that dynamically creates a new button through JavaScript that when
I have a button element that I've created like so: $submit = new Zend_Form_Element_Button('submit');
I have a SWING UI that contains a button that creates a new SwingWorker
I have a button that creates a new thread. That thread contains the following.
I have a button on a website that creates a directory and copys a
I have a Delphi program that creates HTML files. Later when a button is
I have a button that is programatically created, it's content is a stack panel
I have created a button CSS class that uses background images with different positions
I have setup a form that allows a user to make selections from drop-down
I created some widgets with jQuery UI and I notice that buttons have 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.