hi all i am appending images inside as a list item in unordered list html and using jquery for inserting item in unordered list dynamically using below code
for(var i=1; i<=5; i++){
$('ul').append('<li class="stage1">'+ stage1img[i]+'</li>')
}
ths image will be loaded on page load now on button click i want to relace all images .i.e all list item(li)with other items as below i have tried
for(var j=6; j<=10;j++){
$('li.stage1').replaceWith('<li>'+ stage1img[j]+ '</li>');
}
I think where you're going wrong is in your jQuery selection. Try adding .eq()
for(var j=6; j<=10;j++){
$('li.stage1').eq(j-6).replaceWith('<li>'+ stage1img[j]+'stage1 </li>');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With