0

I think it's similar to this question, but my problem is about jQuery and HTML5. I'm adding a <LI> element to <UL> and links (<a href="..">) added inside apears as plain text, not clickable. Besides that, images are not visible, while <img src=".."> elements are being added propertly.

Looks like I need some "refresh" trick to do after using append(). Which one?

This is my code, just in case:

$('ul').append($('<li/>').append($('<img/>').attr('src', 'http://example.com')));

The image is not visible, while HTML is being build correctly. I'm trying in Safari 5.1 on Mac.

BTW, everything works perfectly fine in Firefox 10.0. Maybe the actual problem is that I'm using XML+XSL formatting in Safari and plain HTML5 in Firefox..

Community
  • 1
  • 1
yegor256
  • 102,010
  • 123
  • 446
  • 597

2 Answers2

2

This is how it works instead (see this question also):

$('#list').html('<li>foo</li>');
Community
  • 1
  • 1
yegor256
  • 102,010
  • 123
  • 446
  • 597
0

This will add an li element with an image in it.

   $("ul").append("<li><img src='http://www.yourimage/normal.JPG' /> </li>"); 

Here is the sample : http://jsfiddle.net/xchXQ/1/

Shyju
  • 214,206
  • 104
  • 411
  • 497