Q:

how to implement dynamic slide creation-javascript?

I am doing a project in Phone Gap-android.I am implementing functions in java script.I have implemented SWIPE VIEW using this.
Now,I will share the coding i used to implement this so,that it can be helpful to you in finding out my mistake.
var mySwiper = new Swiper('.swiper-container',{
//Your options here:
mode:'horizontal',loop: true, speed : 500, freeMode : true, freeModeFluid : true,
});  

value= VALUE_FROM_DB.split("||");
 for (k=0;k<value.length;k++)
 {
    if (value[0] == paramName1)
   {
      return unescape(value[k]);
      console.log("no of swipe views ");
   }
    var val = k+1;
    var superdiv = document.getElementById('swiper-wrapper');
    var newdiv = document.createElement('div');
    var divIdName = 'swiper-slide'+val;
    console.log("div name: "+divIdName);
    newdiv.setAttribute('id',divIdName);
    newdiv.setAttribute('class','swiper-slide');
    newdiv.style.width = "25%";
newdiv.style.height = "30%";
    superdiv.appendChild(newdiv);
    var cnt1 = '<div id="container" class="container"><span><img src="img/cause_'+val+'.png" style="float:left;"></span><div id="clinicals'+val+'" class="clinical"><span ><h5>'+value[k]+'</h5></span></div></div>';
    console.log("check value"+cnt1);
    document.getElementById(divIdName).innerHTML=cnt1;
    console.log("clinical values: "+value[k]);
console.log("processsing parameter loop ");
var searchString = window.location.search.substring(1),i,val,params = searchString.split("&");
}

html code
<div id="swipe_body">
    <div class="swiper-container swiper-threshold">
        <div class="swiper-wrapper" id="swiper-wrapper">

        </div>
    </div>
</div>

css code:
.clinical       
{
    font-size:15px;text-justify:inter-word;margin-right:10px; margin-left:10px; margin-top:10px; margin-right:10px; margin-bottom:10px;
}
.container
{
 background:url(img/value_bg.png) no-repeat scroll 0 0 transparent; background-size:100% 100%; display:block; width:304px; height:250px;text-align:justify;
}
.container span
{
 width:auto; height:30%; display:block; overflow:hidden;float:left; 
}

now, my output is not the desired one.
Only 1 slide is being displayed.Swipe functionality is not being implemented and the rest other values are no to be seen.
WHAT SHOULD I DO?
please guide me!!.
SECOND ALTERNATIVE,I IMPLEMENTED IS AS FOLLOWS(after the no of swipe views):
var val = k+1;
            var superdiv = document.getElementById('swiper-wrapper');
            var newdiv = document.createElement('div');
            var divIdName = 'swiper-slide'+val;
            console.log("div name: "+divIdName);
            newdiv.setAttribute('id',divIdName);
            newdiv.setAttribute('class','swiper-slide');
            superdiv.appendChild(newdiv);
     --->       var cnt1 ="var newSlide = mySwiper.createSlide('<div id="container" class="container"><span><img src="img/cause_'+val+'.png" style="float:left/>;"></span><div id="clinicals'+val+'" class="clinical"><span ><h5>'+value[k]+'</h5></span></div></div>', 'swiper-slide', 'span');
            document.getElementById(divIdName).innerHTML=cnt1;
            document.querySelector('.swiper-slide');
            console.log("split value: "+value[k]);    

the output error I get is
05-20 12:11:20.214: E/Web Console(6855): Uncaught SyntaxError: Unexpected identifier at file:///android_asset/www/clinical.html?var%20id=0:171 (the line differentiated with an arrow)

THE MOST IMPORTANT FACT IS THAT,ALL 5 VALUES ARE BEING DISPLAYED IN THE LOG.BUT,1 slide is being SEEN.
in simple words swipe functionality is not working.

A:

Try to call mySwiper.reInit(), right after your slides creation. Also take a look at the Slides API http://www.idangero.us/sliders/swiper/api.php#slidesapi

