I just downloaded jstree... and I have a type error
here is all my code, all I linked and etc...
<html>
<head>
<script src="dist/libs/jquery.js"></script>
<link rel="stylesheet" href="dist/themes/default/style.min.css" />
<script src="dist/jstree.min.js"></script>
</head>
<body>
<div id="tree1" data-url="/nodes/">
<ul>
<li id="good">Root node 1
<ul id="hei">
<li id="2">Child node 1</li>
<li id="3"><a href="#">Child node 2</a></li>
</ul>
</li>
</ul>
</div>
<input type="text" name="jsfields" id="jsfields" value="" />
<input type="submit" onclick="submitMe()" value="submit" />
<script type="text/javascript">
$(function () { $('#tree1').jstree({'plugins':["checkbox" , "themes", "html_data"]}); });
function submitMe() {
var checked_ids = [];
checked = $('#tree1').jstree("get_checked",null,true);
checked.each(function(){
checked_ids.push(
this.id);
});
//setting to hidden field
console.log("hei");
document.getElementById('jsfields').value = checked_ids.join(",");
}
</script>
</body>
</html>
I will recive: TypeError: checked.each is not a function on line 54...
can anybody help me?