user3819673
user3819673

Reputation: 17

adding li to ul with loop in jquery mobile

Hi i'm using jquery mobile and i'm adding <li> to <ul> but i don t get why it doesn t work,<li> not adding well i followed this http://jsfiddle.net/Gajotres/HuKab/

looks like the problem comes from the div

Code:

for (i = 0; i < 2; i++) {

    var htmlText = '<li><div style="float:left"><br/><img src="images/steto.png" alt="image" /></div><div style="float:right"><br/><strong>'+i+' aaaaaaaa  </strong><p> '+i+' zzzzzzz : '+i+' zzzzzzzzz<br/> zzzzzzz : <br/> '+i+' RPPS : '+i+' zzzzzzzz </p></div></li>';

    $('ul').append(htmlText);
}
$('ul').listview('refresh');

An image http://hpics.li/b00407e

P.S. : when i do that in html directly it works fine and when i just had one it's work and place well thanks for help sry for english

Upvotes: 0

Views: 1268

Answers (1)

Nemo
Nemo

Reputation: 348

Add trigger( "create" ) with the $('ul').append(htmlText) as follow:

Example

   $('ul').append(htmlText).trigger( "create" );

hope it will work.

If it works don't forget to VOTE

Thank you

Upvotes: 1

Related Questions