jQuery技术:jQuery中的Alert()调用没有显示,在JsTree中调用

我在这段代码中看不到警报。 这可能是一个错字,因为我跟踪代码正在执行,我收到正确的“nodeInfo”警报只是没有出现。

function loadTree(jsonData){ var treeInfo = attachTree(stageTreeData(getJson(jsonData))); $("#apple_tree").jstree({ "json_data": {"data": treeInfo}, "plugins" : [ "themes", "json_data", "ui" ] }).bind("select_node.jstree", function (event, data) { // `data.rslt.obj` is the jquery extended node that was clicked var nodeInfo = data.rslt.obj.attr("id"); alert(nodeInfo); }); } 

感谢您的帮助!

编辑#1更改了代码结构:

 function loadTree(jsonData){ var treeInfo = attachTree(stageTreeData(getJson(jsonData))); $("#apple_tree").jstree({ "json_data": {"data": treeInfo}, "plugins" : [ "themes", "json_data", "ui" ] }); $("#apple_tree").bind("select_node.jstree", function (event, data) { // `data.rslt.obj` is the jquery extended node that was clicked var nodeInfo = data.rslt.obj.attr("id"); alert(nodeInfo); }); } 

仍然没有运气警报()出现。

      以上就是jQuery教程分享jQuery中的Alert()调用没有显示,在JsTree中调用相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/jquerytutorial/558177.html

      (0)
      上一篇 2021年1月26日
      下一篇 2021年1月26日

      精彩推荐