页面加载时给的子元素的第一个元素加class
HTML代码: <div id="xiao"> <ul> <li></li> </ul> </div> js代码: <script> $(function () { $('#xiao').children().eq(0).attr('id','tree'); // console.log($('#d').children().eq(0).attr('id')); $("#tree").treeview({ collapsed: true, animated: "medium", control: "#sidetreecontrol", persist: "location" }); }) </script>
赞赏码
非学,无以致疑;非问,无以广识

浙公网安备 33010602011771号