hello liam, thanks for the tip, i will try using them the same way. you actually forgot one " in your code but now it works fine, thanks!
$("#searchResultList").append('<li class="searchResultEntry" id="' + videoId + '" title="' + titleFull + ' (' + minutes + ':' + seconds +')"><img src="' + thumbnailUrl + '" class="thumbnail" alt="' + titleFull + ' (' + minutes + ':' + seconds + ')"/></li>'); On 4 Feb., 15:51, Liam Potter <radioactiv...@gmail.com> wrote: > you need to switch it around, > > replace all " to be ' and all ' to be " > > Personally, all my selectors use " > then functions use ' > > $("#searchResultList").append('<li class="searchResultEntry"id="' + videoId + > '" title="' + titleFull + ' (' + minutes + ':' + seconds +')'><img src="' + > thumbnailUrl + '" class="thumbnail" alt="' + titleFull + ' (' + minutes > + ':' + seconds + ')"/></li>'); > > that's how I would do this. > > dirk w wrote: > > hello jquery community, > > i am getting some strings from a page i don't have influence on. i > > just append those to elements (thanks to jquery this works like a > > charm!): > > > $("#searchResultList").append("<li class='searchResultEntry'id='" + > > videoId + "' title='" + titleFull + " (" + minutes + ":" + seconds + > > ")'><img src='" + thumbnailUrl + "' class='thumbnail' alt='" + > > titleFull + " (" + minutes + ":" + seconds + ")'/></li>"); > > > my problem is: > > sometimes the variable "title" contains a ' in the string, like > > "doesn't that look funny..." in this case my output get's completely > > messed up. > > is there a more reliable way to use ' and " ? any ideas how i could > > prevent ' to crack this up? > > > thanks in advance > > dirk