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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:05:54+00:00 2026-06-09T22:05:54+00:00

Hey guy’s just a quick question. Im making a sortable, drag and drop system

  • 0

Hey guy’s just a quick question.

Im making a sortable, drag and drop system and i need it, when the user drags the message to the delete box it will .remove(); and will disappear (well remove it) but the issue is it removes the little elements of the message like the subject, I want it to remove the whole div for example one of the “message” elements. So how do you get the parentNode of this which is the message div

It does refresh the messages so don’t worry about the messages

The Code i have is

<div class="message 1" id="1">  // I want to remove this part and only this part
                    <ul id="8">
                        <li class="dragable" id="2">
                            <!-- Dragable -->

                        </li>
                        <li class="checkbox" id="4">
                            <input type="checkbox" name="checkbox" class="checkbox" id="messagecheck1">
                        </li>
                        <li id="3"> 
                            <p> hi</p>
                        </li>
                    </ul>
                </div>

js

$(".messageholder").sortable({          
        start: function(event, ui){
            $(ui.item).css("opacity", "0.25");
            draggable_sibling = $(ui.item).prev();
            $(".deletebox").show();
        },

        stop: function(event, ui) {
            $(".deletebox").hide();
            if (dropped) {
                if (draggable_sibling.length == 0)
                    $('.messageholder').prepend(ui.item);

                draggable_sibling.after(ui.item);
                dropped = false;
            }
            $(ui.item).css("opacity", "1.00");
        },
        update: function(event, ui){
            //Use's Xhr to save the position of the message
            var array = [];
            $(".messageholder div").each(function(e){
                 array.push($(this).attr('id'));
            });
            $.ajax({
                type: 'POST',
                url: 'json/save.php',
                data: ("data="+array)                           
            });

        }   


    }); 

        $(".refresh").click(function(){
            checkmessages();        
        });     

        $(".deletebox").droppable({         
                drop:function(event, ui){
                    dropped = true;                 
                    $(event.target.parentNode).closest('div').remove();


                    }               

        });     


        $(".messageholder").disableSelection();

Their are multiple elements with the same class name so i can’t remove the messages class out in one line of code, I would have to select the element individually and remove it like that.

Link http://grubber.co.nz/messages/

  • 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-09T22:05:55+00:00Added an answer on June 9, 2026 at 10:05 pm

    If you are using jQuery, a quick google search should turn up .parent() : http://api.jquery.com/parent/

    Additional

    You can also use .closest(selector) if you need to use a selector to find an ancestor that’s not the immediate parent : http://api.jquery.com/closest/

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

Sidebar

Related Questions

Hey guy's i'm making a website which involves submiting an ad for a gameserver.
Hey guys. I've just published my first Android application to show this guy who
hey guy I have a question which is why php and mysql so popular
Hey guy's im making a 2D java game and i want to learn how
Hey guy's i'm making a Paddle/Pong game and right now i'm trying to find
Hey I just started dabbling with android programming, and from my short period of
Hey I'm building an app that will allow a user to log into a
Hey how can I clone the table named teamselectiontable with just the table rows
Hey guy's I add made a PHP server status script for my website and
Hey this may be a somewhat simple question, but I'm new to Eclipse and

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.