u013179958
CSDNRGY
2016-02-28 06:12

如何给easyui的某个子节点挂载单击事件?(附demo)

  • easyui

这个demo只能给全部的节点加单击事件
如何只给node111加单击事件?

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
        <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
        <link rel="stylesheet" type="text/css" href="../demo.css">
        <script type="text/javascript" src="../../jquery.min.js"></script>
        <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
    </head>

    <body>
        <ul id="tree">
        </ul>
        <script type="text/javascript">
            $(function() {
                $('#tree').tree({
                    data: [{
                        "text": "node1",
                        "children": [{
                            "text": "node11",
                            "children": [{
                                "text": "node111"
                            }]
                        }]
                    }],
                    "onClick": function() {
                        alert(1);
                    }
                });
            });
        </script>
    </body>

</html> 
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答