jquery class selector doesn't work in IE6 -
eidt: , sorry carelessness. inittree()
fails.
this works fine in ff , chrome:
$("#tree").treeview({ collapse:false, });
this works fine in ff chrome , ie6:
$("#tree").treeview({ collapse:false //<-here key, no comma });
i have tree like:
<ul id="tree"> <li>root <ul> <li>node_1_2<a class='addnode'>add</a><a class='deletenode'>delete</a> <ul> <li>node_2_4<a class='addnode'>add</a><a class='deletenode'>delete</a></li> <li>node_2_6</li> </ul> </li> </ul> </li> </ul>
if click <a>add</a>
, should append chid node element. like:
$("a.addnode").live("click", function() { if($(this).parent().children("ul").html() == null){ leafhtml = ...; $(this).parent().append(leafhtml); } else{ leafhtml = ...; $(this).parent().children("ul").append(leafhtml); } inittree(); });
this works fine in firefox , chrome. in ie6 did nothing. seem $("a.addnode")
didn't work.
first of need way debug happening. there things firebug lite can check out suggest placing couple of alerts.
$("a.addnode").live("click", function() { alert('click caught'); if($(this).parent().children("ul").html() == null){ alert('no children'); leafhtml = ...; $(this).parent().append(leafhtml); } else{ alert('children'); leafhtml = ...; $(this).parent().children("ul").append(leafhtml); } alert('end'); inittree(); });
you know get's called , doesn't called instead of guessing. if should take guess there 2 errors here cause problem. selector fine.
1: $(this).parent().children("ul").html() == null never true. should check against $(this).parent().children("ul").children().length == 0 instead.
2: $(this).parent().children("ul").append(leafhtml) makes no sense. text inside ul not valid , wouldn't suprised if ie6 ignores it(it should).
i suspect #1 makes #2 happend , invalid ie6 ignores it.
Comments
Post a Comment