Jquery..单击另一个表格单元格后,单元格文本未重新显示
Jquery... Cell text not re-displaying after I click on another table cell
我有一张桌子。 它通过PHP显示来自MySQL的数据
我正在使用jquery从用户那里动态获取数据。
当用户单击单元格时:1.单元格文本显示"无"2.选中单元格中的复选框
3.显示供用户输入的输入文本字段
当用户单击关闭单元格(例如到另一个单元格)时,我想要:1.复选框取消选中自身2.输入文本字段消失3.和单元格文本重新显示
除了 3.要重新显示的单元格文本外,我让它们都正常工作。我需要在用户单击另一个单元格时显示单元格的原始文本
$('#table9 tr td').click(function(){
var $this = $(this);
//checks checkbox of cell by default
$this.children('input').prop('checked', true);
//makes sure that checkboxes in other cells are not checked
$this.siblings().children('input').prop('checked', false);
$this.parent('tr').siblings().children('td').children('input').prop('checked', false);
//hides current text in cell if cell is clicked
$('span' , this).css('display','none');
//displays a text field for input
$this.children('.hiddenjqside').css('display' , 'inline');
//hides input text field if user should click on another cell
$this.siblings().children('.hiddenjqside').css('display' , 'none');
$this.parent('tr').siblings().children('td').children('.hiddenjqside').css('display', 'none');
//display the text of the current cell when user click another cell
$('span' , this).siblings().css('display' , 'inline'); <---------NOT WORKING!!!!!!!!!!!!!!
我想
你想做:
$this.siblings().find('span').css('display' , 'inline');
或使用上下文:
$('span' , $this.siblings()).css('display' , 'inline');
此外,您还可以通过使用hide()
和show()
而不是手动更改css display
属性来节省自己的一些键入
好的,
我想通了...我可能没有清楚地说明问题。 以下是我所做的。
$this.siblings().children('span').css('display' , 'inline');
$this.parent('tr').siblings().children('td').children('span').css('display' , 'inline');
相关文章:
- ui网格将单元格显示为选择标记
- 单元格的工具提示或标题不显示超过2000个字符
- ui网格日期单元格过滤器,过滤日期格式导致显示错误的日期
- dhtmlx添加新行并启动单元格编辑器
- 谷歌电子表格在多个单元格中显示脚本中的值
- 从所选内容中选择选项,并在表格单元格中显示所选内容的信息
- 如何使用Javascript和HTML DOM在表的特定单元格中显示数字
- 表格必须具有可单击的单元格才能显示 XML 文件中的更多选项
- Vaadin 日历:如何在事件单元格上显示另一个属性
- 在单元格中显示另一个值时,按一个值对jqGrid进行排序
- 当不处于编辑模式时,下拉列表中的Kendo单元格值显示为未定义
- 如何将表格单元格中显示的数据更改为警报框
- 使用Javascript在表格单元格中显示图像
- 格式化flexigrid中的单元格以显示值
- 以手提式发行.如果我开始纠正错误单元格或更新新单元格,则单元格高亮显示将消失
- 如何刷新具有cellFilter的ui-grid单元格,以便在一个单元格中显示绑定实体的多个字段
- JSON数据中的jQGrid单元格编辑显示URL未设置警报
- ng-grid 如何在最后一行的列单元格中显示/隐藏按钮
- 在表格单元格中显示更多/更少按钮(展开文本)
- 如何在另一个dgrid单元格中显示dojo dgrid选择