wrap() and children()

wrap() and children()

Hello,

I am having trouble using these methods.  Can someone please help? here is my code and question:

First, does anyone know why the wrap method doesn't work with the child selector? the wrapInner is okay with this so I thought it was strange that this wasn't...

  1. var add_li = document.createElement('li');
    $('table.nestedLayoutTable > tr').wrap(add_li);


I also tried using the jquery children method:


  1. $('table.nestedLayoutTable').children(add_li);
  2. and/or
  3. $('table.nestedLayoutTable').children().addClass('survey_list');

The first scenario doesn't do anything unless I remove the '>' but then it adds the <li> tag to all <tr> tags which isn't what i want.
The 2nd scenario adds all <tr> tags to <li> tag - not just the immediate
descendants.
and the 3rd scenario doesn't do anything so I am not even sure if this can be done like this - adding methods together like this

Can anyone help? AGain,I just need to target the immediate descendants of this table.

thanks!


















    • Topic Participants

    • rgqld