Javascript Jquery可编辑表:如何使某些单元格可编辑?

Javascript Jquery可编辑表:如何使某些单元格可编辑?,javascript,jquery,Javascript,Jquery,为了好玩,我正在jquery中构建一个可编辑的表 这是我的桌子: <table id="horiz-min" summary="Indices"> <thead> <tr> <th scope="col"></th> <th scope="col">ID</th> <th scope="col">Description</th>

为了好玩,我正在jquery中构建一个可编辑的表

这是我的桌子:

<table id="horiz-min" summary="Indices">
    <thead>
    <tr>
        <th scope="col"></th>
        <th scope="col">ID</th>
        <th scope="col">Description</th>
        <th scope="col"></th>
        <th scope="col"></th>
        <th scope="col"></th>
    </tr>
    </thead>
    <tbody>

        <tr onclick="show();" id="IDOL-FT">
            <td class="editable" id="edit">Edit</td> 
            <td class="edit-field">454</td>  
            <td class="edit-field">TEXTTEXTTEXTTEXT</td>
            <td class="editable">Details</td>
            <td class="editable">Feeds</td>
            <td class="editable">Fields</td>
        </tr>               

    </tbody>
</table>

身份证件
描述
编辑
454
文本文本文本文本
细节
喂养
领域
我想做的第一件事是通过单击edit使ID和描述可编辑

所以在JQUERY中,我试图用当前在可编辑文本框中的内容替换这些td的内容

修正:但我给出了一个控制台错误“$未定义”

jquery:

$('td.edit-field').replaceWith('<textbox></textbox>');
$('td.edit field')。替换为(“”);
听起来,“$is not defined”似乎没有正确地将jQuery包含在HTML文件中。确保以下内容出现在HTML文件的标题部分(根据需要调整版本)

使用属性

<td class="editable" id="edit"  contenteditable="true">Edit</td> 


$('#edit').click(function() {
    $('.editable').attr("contenteditable", "true");
})
编辑
$(“#编辑”)。单击(函数(){
$('.editable').attr(“contenteditable”,“true”);
})

这就解决了这个问题,现在我只需要获取文本中的当前内容box@iwant_B_smrtr你所说的当前内容是什么意思?它来自哪里?它只是静态内容,它来自我的sql experss management studio dbso基本上,他们单击“编辑”后的内容是:454如果有意义的话?嘿,我试过这个,看起来很酷,但不是为了我现在正在做的事
$(document).ready(function() {
  $('#IDOL-FT').click(function() {
    show();
  });
});
<td class="editable" id="edit"  contenteditable="true">Edit</td> 


$('#edit').click(function() {
    $('.editable').attr("contenteditable", "true");
})