Okay
  Public Ticket #2091602
HTML code changed when saving table
Closed

Comments

  • Sam started the conversation

    I have created a table and would like to add html to a cell.  I have the data type as String with multi-line editing.  I am trying to add this code to the cell:

    <div class="tooltip">Hover over me
      <span class="tooltiptext">This is the tooltip text!</span>
    </div>

    When I save it the cell looks blank and when I go back to edit the contents the code now looks like this:

    <a href='<div class="tooltip">Hover over me
      <span class="tooltiptext">This is the tooltip text!
    </div>' target='_self'><div class="tooltip">Hover over me
      <span class="tooltiptext">This is the tooltip text!
    </div></a>

    This is clearly bad HTML so the cell renders nothing.  Below is the Custom CSS that I have added to the settings page to make this tooltip work in case there are issues with that as well.  Please advise why this is happening.

    Custom CSS:

    .tooltip {
      position: relative;
      display: inline-block;
      border-bottom: 1px dotted black;
    }

    .tooltip .tooltiptext {
      visibility: hidden;
      width: 120px;
      background-color: #333;
      color: #fff;
      text-align: center;
      border-radius: 6px;
      padding: 5px 0;
      position: absolute;
      z-index: 1;
      bottom: 150%;
      left: 50%;
      margin-left: -60px;
    }

    .tooltip .tooltiptext::after {
      content: "";
      position: absolute;
      top: 100%;
      left: 50%;
      margin-left: -5px;
      border-width: 5px;
      border-style: solid;
      border-color: black transparent transparent transparent;
    }

    .tooltip:hover .tooltiptext {
      visibility: visible;
    }


    Sam


  •  2,572
    Aleksandar replied

    Hi again Sam.

    I added the same code to a multi-line string cell, and it showed up normally even after I try to edit it.

    As for the custom class, it does look good, but it doesn't do anything on my end either. Please note, though, that since this is not a built-in feature of the plugin, debugging and writing custom code is not included in the support of the plugin, and is only offered as pain custom work.

    I tried to make it work, but couldn't, so unfortunately I cannot help you with it. The only thing I can do is take a look at your table in back-end, if you provide me remote access, and see why it changes the content of the cell.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables