📜 ⬆️ ⬇️

JQuery checkbox categories tree

Begin



Making a catalog. It was necessary to make a tree of product categories / companies / services with infinite nesting. Each category can be checked by checkbox, so that later you can get a list / array of all selected categories (for example, to search by them).

Wrote this tree here. Implemented as a plugin to your favorite jQuery)
')

What can:




It seems to have not forgotten anything)

Options:



Using:
$( '.sp-tree-container' ).tree({_loadPath: 'php/li.html' });

* This source code was highlighted with Source Code Highlighter .


I will explain a little: the li element which has nested lists must have a folder class, all ul that must be visible have an expanded class. The title of the category is thrust into the span, just by clicking on it and the folding / unfolding of the sub-branch occurs.

Well, everything seems to be ...

Strong beauty has not yet suggested, so do not judge. I will accept constructive criticism;)

Source: https://habr.com/ru/post/63543/


All Articles