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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:29:25+00:00 2026-05-20T12:29:25+00:00

I have just started to study jQuery and it seems to be full of

  • 0

I have just started to study jQuery and it seems to be full of opportunities, if I can just learn it.

I have created a table with the last cell containing delete-button. By clicking the button I’ll like to have an confirmation dialog to appear and if the user accepts the row will be deleted. Cancel just closes the confirm dialog.

But I have no idea how to do that, even after reading many examples posted here in stackoverflow or in other sites as well. I just couldn’t adapt those to my project.
So, I love to have guidance for this matter.

My script looks like this now:

<script>
$(document).ready(function(){
    $("#dlgConfirm").hide();
});

$(function() {
    $("#dlgLink").click(function(){
        $( "#dlgConfirm" ).dialog({
            resizable: false,
            height:140,
            modal: true,
            buttons: {
                "Delete selected toon": function() {
                    $( this ).dialog( "close" );
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            }
        });     
});
});
</script>

An the html contains these:

<div class="modalForm">
        <div id="toons-contain" class="ui-widget">
            <h1>Toons:</h1>
            <table id="toons" class="ui-widget ui-widget-content">
                <thead>
                    <tr class="ui-widget-header ">
                        <th class="date">Date</th>
                        <th class="name">Name</th>
                        <th class="note">Note</th>
                        <th class="del">Delete?</th>
                    </tr>
                </thead>
                <tbody>
                    <tr id="row_1">
                        <td>02.03.2011</td>
                        <td>Michael</td>
                        <td>Driving with KITT</td>
                        <td><a href="#" id="dlgLink" class="ui-state-default ui-corner-all">Delete</a></td>
                    </tr>
                    <tr id="row_2">
                        <td>05.03.2011</td>
                        <td>Dredd</td>
                        <td>Criminal hunting</td>
                        <td><a href="#" id="dlgLink" class="ui-state-default ui-corner-all">Delete</a></td>
                    </tr>
                </tbody>
            </table>
        </div>
</div>
<div id="dlgConfirm" title="Delete the selected toon?">
    <p>
    <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
    Toon will be deleted and cannot be recovered. Are you sure?
    </p>
</div>

This will work nicely to get the table done and by clicking the delete button that confirm dialog opens.

So can you help me to delete the row where the user clicked it?

  • 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-20T12:29:26+00:00Added an answer on May 20, 2026 at 12:29 pm

    First, IDs should be unique. Especially when you add jQuery triggers to them.

    For example, this is how I would have done this : http://jsfiddle.net/Nbf9K/

    HTML:

    <div class="modalForm">
            <div id="toons-contain" class="ui-widget">
                <h1>Toons:</h1>
                <table id="toons" class="ui-widget ui-widget-content">
                    <thead>
                        <tr class="ui-widget-header ">
                            <th class="date">Date</th>
                            <th class="name">Name</th>
                            <th class="note">Note</th>
                            <th class="del">Delete?</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr id="row_1">
                            <td>02.03.2011</td>
                            <td>Michael</td>
                            <td>Driving with KITT</td>
                            <td><a href="#" class="deleteRow ui-state-default ui-corner-all">Delete</a></td>
                        </tr>
                        <tr id="row_2">
                            <td>05.03.2011</td>
                            <td>Dredd</td>
                            <td>Criminal hunting</td>
                            <td><a href="#" class="deleteRow ui-state-default ui-corner-all">Delete</a></td>
                        </tr>
                    </tbody>
                </table>
            </div>
    </div>
    <div id="dlgConfirm" title="Delete the selected toon?">
        <p>
        <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
        Toon will be deleted and cannot be recovered. Are you sure?
        </p>
    </div>
    

    Javascript:

    $(document).ready(function(){
        $("#dlgConfirm").hide();
    });
    
    $(function() {
        $(".deleteRow").click(function(){
            var $row = $(this).parent('td').parent('tr');
            $( "#dlgConfirm" ).dialog({
                resizable: false,
                height:140,
                modal: true,
                buttons: {
                    "Delete selected toon": function() {
                        $row.remove();
                        $( this ).dialog( "close" );
                    },
                    Cancel: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });     
    });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started to study computer sciences at my university where they teach
I have just started playing with the ASP.Net MVC framework, and today I created
I just started study of class and object in php. I have a very
I have just started working with with Styles and Control Templates and have created
I have just started learning C#. Can anyone explain the technical differences between a
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have just started playing with ASP.NET MVC and have stumbled over the following situation.
I have just started using silverlight 2 beta and cannot find how to or
I have just started using Boost 1.36. These libraries would be very useful in

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.