loosing jquery mobile look when adding something dynamically
Hi everyone,
I'm developping a mobile web site and I have to dawnload a JSON list, this is working. Then I want the slider "On/Off" for each element of my list, so I did this :
- function affichage_intensite()
- {
- var i;
- var $lampes=$('#lampes_intensite');
- for(i=0;i<3;i++)
- {
- window.console.log("<label for=\""+tableau_lampes[i].name+"\">"+tableau_lampes[i].name+"</label>\n\
- <select name=\""+tableau_lampes[i].name+"\" id=\""+tableau_lampes[i].name+"\" data-role=\"slider\">\n\
- <option value=\"off\">Off</option>\n\
- <option value=\"on\">On</option> </select>");
- $lampes.append("<label for=\""+tableau_lampes[i].name+"\">"+tableau_lampes[i].name+"</label>\n\
- <select name=\""+tableau_lampes[i].name+"\" id=\""+tableau_lampes[i].name+"\" data-role=\"slider\">\n\
- <option value=\"off\">Off</option>\n\
- <option value=\"on\">On</option> </select>");
-
- }
- }
I have the good things but with the look of HTML5 and not with the jquery slider...
My HTML for this is :
- <div class="centrer" data-role="fielcontain">
- <label for="intensite">Changement d'intensité</label> <select name="intensite" id="intensite" data-role="slider">
- <option value="off">Off</option>
- <option value="on">On</option>
- </select>
-
- <div id="lampes_intensite"></div>
- </div>
Someone can help me ?
Thanks !