I'd take a guess that "$(this)" isn't what you think it is, hence it doesn't work
but without more code, it's hard to know for sure On Mar 19, 9:20 am, 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