Never mind. I found a solution. Append the empty list item first then in a
second append the object like
jQuery('#sidebar-users-others ul').append('<li></li>');
jQuery('#sidebar-users-others ul li:last').append(avatar_a_html);
Unless someone has a more elegant solution.
P-
On Feb 20, 2012, at 1:58 PM, Paul Menard wrote:
> I'm having a brain malfunction or something. Need a second set of eyes for
> some jQuery code.
>
> The basic process is that I'm selecting a section of the site and grabbing
> all the anchors with a specific class. No big deal there. Then for each
> object found I need to append this as a list item to another section
> (sidebar) <ul></ul>
>
> I need to be agnostic about the anchor since it sometime will contain text
> and sometimes an image and sometime both. So I'm trying to just grab the
> anchor object which will contain the anchor and all children.
>
> Here is my simple code. The destination element '#sidebar-users-others ul' is
> already present but empty.
>
>
> jQuery('div#content-area a.users').each(function() {
>
> // Clone the found anchor...
> var user_a_html = jQuery(this).clone();
>
> // This works but it adds the anchor inside the <ul> But I need this
> wrapped in <li></li>
> //jQuery('#sidebar-users-others ul').append(avatar_a_html);
>
> // This does not works.
> jQuery('#sidebar-users-others ul').append('<li>+avatar_a_html+'</li>');
>
>
> });
>
--
Our Web site: http://www.RefreshAustin.org/
You received this message because you are subscribed to the Google Groups
"Refresh Austin" group.
[ Posting ]
To post to this group, send email to [email protected]
Job-related postings should follow http://tr.im/refreshaustinjobspolicy
We do not accept job posts from recruiters.
[ Unsubscribe ]
To unsubscribe from this group, send email to
[email protected]
[ More Info ]
For more options, visit this group at
http://groups.google.com/group/Refresh-Austin