Home >Web Front-end >JS Tutorial >jquery implements clicking on the TreeView text parent node to expand/collapse the child nodes_jquery

jquery implements clicking on the TreeView text parent node to expand/collapse the child nodes_jquery

WBOY
WBOYOriginal
2016-05-16 17:44:031555browse

The essays that were previously posted by an account that is no longer in use now can be moved here as human flesh.
I have been a registered user for a while and have been very busy. I haven’t written an article yet. I suddenly felt that I must take some time to record and summarize something. Well, it starts here.

Today, when the customer asked to click on the parent node of the menu (implemented by TreeView), expand the node. I thought this should be a very common function, so I googled it and found that most of them are not implemented in js. Some js implementations are troublesome to write, so I might as well write one myself. It shouldn't be difficult.

The first idea is, jquery implements clicking on the TreeView text parent node to expand/collapse the child nodes_jquery, let the event numbered ' ' on the left be executed when the text is clicked. Check the source code and see that the event numbered ' ' is:
javascript:TreeView_ToggleNode(ctl00_body__menuTree_Data,0, document.getElementById('ctl00_body__menuTreen0'),' ',document.getElementById('ctl00_body__menuTreen0Nodes'))
Ok, the next step is to filter out all the parent nodes, add event processing and it will be ok. Here is the complete code:

Copy code The code is as follows: