A couple things that could help in debugging: ID's are unique, and can't begin with a number. Check the quotes on this line around #favorites:
var appendHTML = $(‘#favorites’).html(); On Aug 19, 12:48 pm, "Rick Faircloth" <r...@whitestonemedia.com> wrote: > Hi, Dhruva, and thanks for the reply… > > Yes, there are a lot of variables that could affect the actual data, but I > just wanted to make sure, first, > > that it wasn’t a syntax problem. > > Since it’s not, I’ll go a little deeper. > > Basically, I’ve got backend code that generates html and outputs it to a page. > > This is what ends up on the page (userFavoritesHTML.cfm): > > <li> > > <a id="59" class="viewFavoriteDetails link">216 West Daryl Drive, > Hinesville</a> > > <span id="59" class="deleteFavorite"> > > <img src="../graphics/delete_over.png" style="border:0; > cursor:pointer;"> > > </span> > > </li> > > <li> > > <a id="60" class="viewFavoriteDetails link">51 Julie Lane, Midway</a> > > <span id="60" class="deleteFavorite"> > > <img src="../graphics/delete_over.png" style="border:0; > cursor:pointer;"> > > </span> > > </li> > > Now I want to append that code to this element: <ul class=”menu1”></ul> > > So, I thought I’d do this: > > var favoritesHTML = '../components/userFavoritesHTML.cfm?' + new > Date().getTime(); > > $('#favorites').load(favoritesHTML); > > var appendHTML = $(‘#favorites’).html(); > > $('.menu1').append(appendHTML); > > I need to get the html of #favorites since it’s an <li></li> in the above > <ul></ul>, > > otherwise, I end up with li’s embedded within other li’s. > > When I run the code above, I get no errors from Firebug, but also no content > if > > I use alert(appendHTML), and no content is appended to <ul > class=”menu1”></ul>. > > Thoughts or suggestions? > > Rick > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > Behalf Of Dhruva Sagar > Sent: Wednesday, August 19, 2009 1:54 PM > To: jquery-en@googlegroups.com > Subject: [jQuery] Re: Is this sytax legitimate? > > It depends on what $('#favorites').html() contains, have you checked that? > Are you sure the id is correct? > The syntax by itself is absolutely correct, but what you should see in your > site is something that depends on a lot of things such as what the > $('menu1') contains and what it should etc...try checking if the .html() is > returning the right data, then check if it is actually getting appended using > firebux, after you have reached that stage and confirmed the same check if > the styles are right... > > Thanks & Regards, > Dhruva Sagar. > > Pablo Picasso > <http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html> - > "Computers are useless. They can only give you answers." > > On Wed, Aug 19, 2009 at 11:11 PM, Rick Faircloth <r...@whitestonemedia.com> > wrote: > > $('.menu1').append($('#favorites').html()); > > I get no errors in firebug when it’s run, but not code appended to .menu1, > either… > > --------------------------------------------------------------------------- > ------------------------------------------- > > "Ninety percent of the politicians give the other ten percent a bad > reputation." - Henry Kissinger