The code looks like this $("th.name ").livequery('click', function() { var $selected = $(this).children("th.name");
if($selected.is(":hidden")){ console.log($selected); console.log($selected.find("b").length); $selected.find("b").removeClass().addClass("subtraction"); $selected.find("a").hide().end ().slideDown("slow", function(){ $selected.find("a").fadeIn(); }, "easeOutCubic"); } else { $selected.find("b").removeClass().addClass("add"); $selected.find("a").fadeOut(function(){ $selected.slideUp("slow", "easeInQuart"); }); } }; On Mar 19, 1:31 pm, "T.J. Crowder" <t...@crowdersoftware.com> wrote: > Hi Martin, > > (Disclaimer: I'm really new at jQuery, though not at DOM scripting.) > > It sounds like you're saying that this line: > > > var $selected = $(this).children("th.name"); > > ...isn't finding any matching elements and that that's why you can't > find the <b> child of the <th>. What's the context in which you're > executing that line? Some event handler? If so, on what element? It > would have to be the immediate parent of the <th> (e.g., a <tr>) for > it to find it, since recall that #children finds only _direct_ > children of the context. > > With a bit more context (no pun!) we can probably figure it out, if > the above isn't helpful. > > FWIW, > -- > T.J. Crowder > tj / crowder software / com > Independent Software Engineer, consulting services available > > On Mar 19, 1:20 pm, Martin <martin.ikedia...@gmail.com> wrote: > > > > > Hello, > > > I am trying to grab the child of element in my html (see below) > > > <th class="name" colspan="4"> > > > > <b class='add'> </b> > > </th> > > > I am trying to use this Jquery Code to grab the "b" child element of > > "th". I want to change the class element for b from "add" to > > "subtraction" > > > var $selected = $(this).children("th.name"); > > > console.log($selected); /* returns Object length=0 prevObject=Object > > context=th.name */ > > console.log($selected.find("b").length); /* returns 0 */ > > > When I try to select b, for obvious reasons the remove and add class > > doesnt work > > > $selected.find("b").removeClass().addClass("subtraction"); > > > Does anyone have a solution to this problem? > > > Regards > > > Martin Ikediashi- Hide quoted text - > > - Show quoted text -