dongyong3554 2019-08-19 04:40
浏览 129
已采纳

禁用以在选择元素时选择其他元素

I have an editable table when double click will change to and display update and cancel button. I would like to make it if one row or column are selected to edit, other element cannot be select for edit.

PHP

<table>
    <tr>
        <td>
            <table class="table small">
                <tr>
                    <td>Tb1</td>
                    <td class="editable myTd1" name="'.$arr['td1'].'" ondblclick="showEditable(this);"><span>...</span></td>
                </tr>
                <tr>...</tr>
                <p class="myBtn text-center" hidden>
                    <button class="update">Update</button>
                    <button class="cancel">cancel</button>
                </p>
            </table>
        </td>
        <td>...</td>
    </tr>
</table>

Javascript:

function showEditTable(isMy){
    var $this = $(isMy);
    var $id = $this.attr("name");
    var $col = $.trim($this.attr("class").replace("editable", ""));
    $(".myBtn").hide();
    $this.parents("td").find(".myBtn").show();
    var $input = $("<input>", {
                value: $this.find("span").attr("name"),
                type: "date",
                blur: function(){myUpdate($this, $col, $id);}
   }).appendTo( $this.empty()).focus();
}
  • 写回答

2条回答 默认 最新

  • douhuigan8063 2019-08-19 04:46
    关注

    You can write the following code in onclick event

    $(this).siblings("td").css("pointer-events","none");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法