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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:58:29+00:00 2026-06-18T02:58:29+00:00

I have written html file, where in I have created a table. So for

  • 0

I have written html file, where in I have created a table. So for each row I want to define add, edit and delete links.

The code for html file is as below:

        <div id="users-contain" class="ui-widget">
        <h1>Existing Users:</h1>
        <table id="users" class="ui-widget ui-widget-content">
            <thead>
                <tr class="ui-widget-header ">
                    <th>Name</th>
                    <th>Email</th>
                    <th>Password</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="custom-name">John Doe</td>
                    <td>john.doe@example.com</td>
                    <td>johndoe1</td>
                    <td><a href="">Edit</a></td>
                    <td><span class="delete"><a href="">Delete</a></span></td>
                </tr>
            </tbody>
        </table>
    </div>
    <button id="create-user">
        Create new user
    </button>

The modal for add action is as below:

        <div id="dialog-form" title="Create new user">
        <p class="validateTips">
            All form fields are required.
        </p>
        <form>
            <fieldset>
                <label for="first_name">First Name</label>
                <select id="first-name">
                    <option value="1">Arun</option>
                    <option value="2">Ganesh</option>
                    <option value="3">Suresh</option>
                    <option value="4">Sanganabasu</option>
                </select>
                <label for="last_name">Last Name</label>
                <select id="last-name">
                    <option value="1">Hulagabal</option>
                    <option value="2">Cheemalamudi</option>
                    <option value="3">Ganiger</option>
                    <option value="4">Kattriguppe</option>
                </select>
                <label for="email">Email</label>
                <input type="text" name="email" id="email" value="" class="text ui-widget-content ui-corner-all" />
                <label for="password">Password</label>
                <input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />
            </fieldset>
        </form>
    </div>

And the Javascript code is as below:

$(function() {

            var fname = $("#first-name"), lname = $("#last-name"), email = $("#email"), password = $("#password");

            $("#dialog-form").dialog({
                autoOpen : false,
                height : 300,
                width : 350,
                modal : true,
                buttons : {
                    "Create an account" : function() {
                        $("#users tbody").append("<tr>" + "<td>" + (fname.find("option:selected").text()+' ').concat(lname.find("option:selected").text())+ "</td>" + "<td>" + email.val() + "</td>" + "<td>" + password.val() + "</td>" + "<td><a href='' class='edit'>Edit</a></td>" + "<td><span class='delete'><a href=''>Delete</a></span></td>" + "</tr>");
                        $(this).dialog("close");

                    },
                    Cancel : function() {
                        $(this).dialog("close");
                    }
                },
                close : function() {
                    allFields.val("").removeClass("ui-state-error");
                }
            });

              $('span.delete').live('click', function() {  
                $(this).closest('tr').find('td').fadeOut(1000, 
                    function(){ 
                        // alert($(this).text());
                        $(this).parents('tr:first').remove();                    
                    });    

                return false;
            });
            $("#create-user").button().click(function() {
                $("#dialog-form").dialog("open");
            });
        });

The add and delete actions are working now and I have created a http://jsfiddle.net/sangu0009/FvAuZ/ but I need to write edit action. Please help me with some solutions to how to do it. The work is more appreciated.

  • 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-18T02:58:30+00:00Added an answer on June 18, 2026 at 2:58 am

    Here is something you can start with,

    Change the Edit link to a span with class edit.

    $('span.edit').on('click', function() {  
    
        $("#dialog-form").dialog({
            autoOpen : false,
            height : 300,
            width : 350,
            modal : true,
            buttons : {
                "Edit an account" : function() {
    
                    name = $(this).closest('tr').find('td.custom-name').text().split(' ', 2);
                    email = $(this).closest('tr').find('td:nth-child(2)').text();
                    pass = $(this).closest('tr').find('td:nth-child(3)').text();
                    var fname = name[0], lname = name[1];
    
                    $("#first-name option:contains('" + name[0] + "')").attr('selected', 'selected');
                    $("#last-name option:contains('" + name[1] + "')").attr('selected', 'selected');
                    $("#email").text(email);
                    $("#password").text(pass);
    
                },
                Cancel : function() {
                    $(this).dialog("close");
                }
            },
            close : function() {
                allFields.val("").removeClass("ui-state-error");
            }
        });
    
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a written up HTML file using the Google Maps API v3. All
I have written xml file which contains html tags as element like <component> <input
I have written this code inside a servlet to delete certain records from three
I have a text area written in html. I want to get its text
I have a webpage written in HTML. I have a dropdown list that is
I have written the following regex to match a set of e-mails from HTML
Well, i have written a simple python program that parses HTML with HTMLParser. Here
I have a web application written in pure JavaScript (no pre-generated HTML except for
I have written this code in JavaScript and works perfectly fine when I include
I have written a program in Java to read in a text file of

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.