Take a look at the free JSTree user control. It is based on JavaScript, open source and allows you to customize several styles of tree views, for example:

Since the checkboxes displayed here are just images, you can easily replace them using the radio buttons, and when processing events, you can prohibit multiple selections so that they behave like switches, if necessary.
This is achieved by specifying the "checkbox" plugin as follows (see JSFiddle I presented the full working code):
$(function () { $("#demo1") .jstree({ "themes": { "theme": "apple","dots": false,"icons": false }, "plugins": ["themes", "html_data", "checkbox", "sort", "ui"] }); });
The corresponding HTML structure looks like this: just include it in the body of your page:
<div id="demo1" class="demo" style="height:100px;"> <ul> <li id="phtml_1"> <a href="#">Root node 1</a> <ul> <li id="phtml_2"> <a href="#">Child node 1</a> </li> <li id="phtml_3"> <a href="#">Child node 2</a> </li> </ul> </li> <li id="phtml_4"> <a href="#">Root node 2</a> </li> </ul> </div>
To get checked values, use this function (if you created a div with id="listForDisplay" , as it was in the JSFiddle example):
function displayList() { var result=$("#listForDisplay"); var checked = $("#demo1").jstree("get_checked", null, true); var selectedNodes=""; result.text(selectedNodes); $(checked).each(function (i, node) { var id = $(node).attr("id"); var text = $("#"+id).text(); var parentId = $(node).attr("parentId"); alert(parentId); alert(id); if (selectedNodes!=="") selectedNodes+=","; selectedNodes+=text; }); result.text(selectedNodes); }
This code can be fired in a click event, or you can bind JSTree events like me. Adding the following to the previous JavaScript snippet does the job:
$("#demo1") .bind('loaded.jstree', function (e, data) { displayList(); }) .bind('change_state.jstree', function (e, data) { displayList(); });
The only problem is that displayList() seems to create duplicate entries when the entire parent is selected (which means that the parent names are specified along with the children).
Read more about the parameters that determine the behavior of this plugin here .