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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:19:27+00:00 2026-05-12T01:19:27+00:00

I am using jEditable to edit a table inline, the third column of which

  • 0

I am using jEditable to edit a table inline, the third column of which contains email addresses. This column contains plaintext, but it is converted to mailto: links using jQuery . Currently, when jEditable is activated, the user sees this: <a href="mailto:example@example.net">example@example.net</a>

How do I force jEditable to treat these <td>s as plaintext, so that the user making the changes won’t have to deal with HTML and will instead just see this: example@example.net?

This is the jQuery concerned:

$(document).ready(function() {  
    var init;
    $('table#data tbody td').editable( 'media/support/save.php', {
        event: "dblclick",
        submit: "OK",
        cancel: "Cancel",
        tooltip: "Double-click to edit...",
        "callback": function(sValue,y) {
            alert('The server has been updated.'); 
            var aPos = init.fnGetPosition(this); 
            init.fnUpdate( sValue, aPos[0], aPos[1] );
        }
    });

    var init = $("table#data").dataTable({
        "sDom": 'lfr<"clear">tip<"clear">T', 
        "bStateSave": true,
        "fnDrawCallback": function() {
            $('table#data tbody tr').each(function() {  
                var email = $(this).find('td:last');
                $(email).html('<a href="mailto:' + $(email).text() + '">' + $(email).text() + '</a>');
            }); 
        },
        "aaSorting": [[ 0, "asc" ]]
    });
});

I apologize for the big chunk of code, but most of it seemed important.

  • 1 1 Answer
  • 1 View
  • 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-12T01:19:27+00:00Added an answer on May 12, 2026 at 1:19 am

    I am not able to setup a test page but here’s an idea. I looked at the jEditable source and it has an event called ‘onedit’. This event is triggered before the actual edit is performed. Subscribe to this event and change the content of the cell to normal text. In the callback function, reformat the value to have a mailto:link.

    Something like:

    $(document).ready(function() {  
        var init;
    
        $('table#data tbody td').editable( 'media/support/save.php', {
                event: "dblclick",
                submit: "OK",
    
                //I am assuming that 'this' will refer to the 'TD' which user double clicked on.
                //If not, change the code accordingly.
                onedit : function(settings, self) { $(this).html($(this).text()); }
    
                onreset : function(settings, original) 
                          { 
                             //We have added 'emailAddress class to our TD in initial setup.
                             //When user cancels editing and the cancelled cell has the 'emailAddress' class,
                             //we format it to have mailto link.
                             if($(this).hasClass('emailAddress'))
                             {
                                $(this).html('<a href="mailto:' + $(this).text() + '">' + $(this).text() + '</a>')
                             }
                          },
    
                cancel: "Cancel",
                tooltip: "Double-click to edit...",
                "callback": function(sValue,y) {
                        alert('The server has been updated.'); 
    
                        //TODO: If the edited cell was the email cell, if yes, then format the email with mailto link.
    
                        var aPos = init.fnGetPosition(this); 
                        init.fnUpdate( sValue, aPos[0], aPos[1] );
                }
        });
    
        var init = $("table#data").dataTable({
            "sDom": 'lfr<"clear">tip<"clear">T', 
                "bStateSave": true,
                "fnDrawCallback": function() {
                    $('table#data tbody tr').each(function() {  
                    var email = $(this).find('td:last');
                        $(email)
                            .html('<a href="mailto:' + $(email).text() + '">' + $(email).text() + '</a>')
                            .addClass('emailAddress'); //Add 'emailAddress' class so that we can idenfiy this cell during onreset of jEditable.
    
                        }); 
            },
            "aaSorting": [[ 0, "asc" ]]
        });
    });
    

    EDIT 1:

    From looking at the source, jEditable fires ‘onreset’ event if user clicks cancel. I have updated the code above. Try it.

    EDIT 2:

    Modified the code so that when user cancels editing, email address is formatted correctly. To achieve this, we add ’emailAddress’ class to TDs which contains emails. This class is checked in the onreset method.

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

Sidebar

Ask A Question

Stats

  • Questions 208k
  • Answers 208k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Bash is still using readline. Readline uses either emacs or… May 12, 2026 at 9:39 pm
  • Editorial Team
    Editorial Team added an answer You may want to look at these links, but the… May 12, 2026 at 9:39 pm
  • Editorial Team
    Editorial Team added an answer When you float it, you implicitly make it a block… May 12, 2026 at 9:39 pm

Related Questions

I am creating a Web application using ASP.NET MVC, and I'm trying to use
I have been looking for a really good, well documented jquery plug-in that will
I am using jquery's $.post() function to add a list entry to the mysql
I am using SVN for development tasks, but still have many files managed with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.