Tree
by darkajax
HTML
<div id="view" height=90%>
<ul id="view_stree_content" class="stree navbar">
<li>
<value=1 "" a href="#">Furniture</a>
<ul class="active">
<li>
<value=2 a href="#">Living Room</a>
<ul class="active">
<li>
<value=3 a href="#">Sofa</a>
</li>
<li>
<value=4 a href="#">Sectionals</a>
</li>
</ul>
</li>
<li>
<value=5 a href="#">Bed Room</a>
</li>
</ul>
</li>
</ul>
</div>
CSS
body {
font-family: Verdana, Helvetica, sans-serif;
background-color: #DDDDD;
font color="red"';
}
#tabs {
font-size:0.75em;
min-height: 400px;
overflow:auto;
}
.navbar {
width:20%;
float:left;
}
.comment {
width:50%;
float:right;
}
.stree, .stree ul {
list-style-type:none;
padding:0;
margin:0;
}
.stree li {
cursor:pointer;
background:#999;
border-bottom:1px solid #333;
}
.stree li a {
text-decoration:none;
}
.stree a:hover {
background:#333;
color:#fff;
border-color:red;
}
.stree > li > a {
padding:2px 10px;
font-weight:bold;
}
.stree li li {
cursor:pointer;
border:0;
padding:0 14px;
background-color:#fff;
}
.highlight {
background:yellow;
color=red;
}
JavaScript
var myGlobals = {};
$(document).ready(function () { myGlobals.vtree = 0;
// Expect to change to color on click and get the value of li
$('#view_stree_content li').on('click', 'li', function () {
alert('came here');
// expect to return li value
alert($(this).value);
$(this).addClass("highlight");
});