Javascript 如何将悬停效果添加到<;表>;使用编辑器?

Javascript 如何将悬停效果添加到<;表>;使用编辑器?,javascript,jquery,html,css,ckeditor,Javascript,Jquery,Html,Css,Ckeditor,我用编辑器画了一张桌子 你可以看到我当前的桌子是这样的 目前,我想悬停在表格的列上,它会自动突出显示橙色的check图标 我发现要更改CSS: CKEDITOR.config.contentsCss = '/mycustom.css'; CKEDITOR.replace('myfield'); 我不知道如何在表格中申请 我的桌子的结构如下: <tr> <td></td> <td></td> <td>

我用编辑器画了一张桌子

你可以看到我当前的桌子是这样的

目前,我想悬停在表格的列上,它会自动突出显示橙色的check图标

我发现要更改CSS:

CKEDITOR.config.contentsCss = '/mycustom.css';
CKEDITOR.replace('myfield');
我不知道如何在表格中申请

我的桌子的结构如下:

<tr>
    <td></td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td></td>
    <td></td>
</tr>
<tr>
    <td></td>
    <td></td>
</tr>

下面是一个脚本,用于突出显示带有橙色背景色复选标记的列

var CKE = $( '.editor' );
CKE.ckeditor();
var columnIndex=0;

$("#update").click(function(){
    // Output CKEditor's result in a result div
    $("#result").html(CKE.val());

    // If there is a table in the result
    if( $("#result").find("table") ){
        console.log("Table found.");

        // On mouse over a td
        $("#result").find("td").on("mouseover",function(){
            // find the column index
            columnIndex = $(this).index();

            // Condition is to ensure no highlighting on the 2 firsts columns
            if(columnIndex>1){
                $(this).closest("table").find("tr").each(function(){
                    var thisTD = $(this).find("td").eq(columnIndex);

                    // If cell is not empty
                    //   &nbsp; is the html entity for a space
                    //   CKEditor always insert a space in "empty" cells.
                    if( thisTD.html() != "&nbsp;" ){
                        thisTD.addClass("highlight");
                    }
                });
            }

            // Clear all hightlights
        }).on("mouseout",function(){
            $(this).closest("table").find("td").removeClass("highlight");
        });
    }

    // Console log the resulting HTML (Usefull to post HTML on StackOverflow!!!)
    console.log("\n"+CKE.val())
});
我花时间根据您的表格制作了一个演示。
请下次发布你的HTML


请参阅上的工作演示

我没有使用过ckeditor,但现在想试一试。快速提问,您是否使用表格插件生成表格?仅使用默认工具在工具栏上创建表格。我不使用任何插件。我很感激!根据我的表格建立答案不是你的语言。你太棒了。谢谢你。。。试图掌握javascript等语言。。。越南语不是问题(感谢谷歌翻译!!!)。Tốt ngáy cho bạ谢谢你,Louyspatricebesette,真的很有趣。