开发者

How to set the url of href in nodes?

开发者 https://www.devze.com 2023-04-11 17:54 出处:网络
D开发者_JS百科oes anyone know how can I set the href url of the links node in the jstree? today it\'s href=\"#\".$(\"your-link-selector\").attr(\"href\",\"new-url-you-want\");

D开发者_JS百科oes anyone know how can I set the href url of the links node in the jstree?

today it's href="#".


$("your-link-selector").attr("href","new-url-you-want");


You must clarify further, what kind of change you wish to apply to the jstree. The anchors in the jstree are not true anchors who serve the common purpose of changing a web page address, but are merely baits for javascript 'click' event so that various tree action could be executed.


simple, just change the data key to an object:

    // `data` can also be an object
"data" : { 
    "title" : "The node title", 
    // omit when not needed
    "attr" : {}, 
    // if `icon` contains a slash / it is treated as a file, used for background
    // otherwise - it is added as a class to the <ins> node
    "icon" : "folder"
},
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号