Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JQuery表行编辑_Javascript_Jquery_Html_Html Table - Fatal编程技术网

Javascript JQuery表行编辑

Javascript JQuery表行编辑,javascript,jquery,html,html-table,Javascript,Jquery,Html,Html Table,我想让用户点击每一行末尾的链接(fa-fa铅笔-充当编辑行链接)(行由用户输入,因此只有标题的HTML代码)。当用户单击此按钮时,仅该特定行应可供用户编辑 然后单击键盘上的enter键应再次将其更改为不可编辑。我不确定如何为此编写JavaScript,下面是我的HTML <div class = "Data"> <div class ="searchBar"> <input ty

我想让用户点击每一行末尾的链接(fa-fa铅笔-充当编辑行链接)(行由用户输入,因此只有标题的HTML代码)。当用户单击此按钮时,仅该特定行应可供用户编辑 然后单击键盘上的enter键应再次将其更改为不可编辑。我不确定如何为此编写JavaScript,下面是我的HTML

<div class = "Data">
                    <div class ="searchBar">
                        <input type = "search" name = "search" id = "search">
                        <a href="#"> <i class = "fa fa-search"></i></a>
                        <button id = "delete">Delete Selected</button>
                    </div>


                <table style ="width:95%" class = "Info">
                    <thead>
                    <tr>
                        <th>Select </th>
                        <th>Name</th>
                        <th>Number</th>
                        <th>Date of Birth</th>
                        <th><a href ="#"><i class = "fa fa-pencil"></i></a></th>
                    </tr>
                    </thead>
                </table>
                </div>

删除所选内容
挑选
名称
数
出生日期

请帮忙,我们将不胜感激

您应该了解有关html属性的更多信息
contenteditable=true
。所以你可以这样做:
$('your_th').attr('contenteditable','true')

在这里了解更多信息:

谢谢,我之前看过这个网站,但我希望用户只能在点击行末尾的编辑按钮时编辑一行
$('.fa.fa pencil')。在('click',function(){//link clicked})
这是一个非常基本的操作,对不起,我不会再深入了。