开发者

Jquery Mobile Dynamic collapsible contents are not taking any style

开发者 https://www.devze.com 2023-04-10 14:41 出处:网络
I am trying to create the dynamic collapsible divs using jquery mobile but the generated div are not taking any styles.

I am trying to create the dynamic collapsible divs using jquery mobile but the generated div are not taking any styles.

Can anybody solve this issue. :)

        jQuery.get('../config/la/e开发者_Python百科nglish.txt', function(data) {

            for (var i = 0; i < data.length; i++) {
                //alert(data[i]);
                $('<div data-role="collapsible" data-collapsed="true" data-theme="c" data-content-theme="d" id="'+data[i]+'"><h3>'+ data[i] +'</h3></div>').appendTo("div#main");
            }
        }); 


$("Selector").find('div[data-role=collapsible]').collapsible();


you could try adding

$(data[i]).collapsible({refresh:true});

in the for-loop, after appending the div to your <div#main>


You have to call the collapsible() method after you finish the Loop in which you are creating the div elements.

Use the container DIV (which contains all the collapsible div elements you created) to call the collapsible() like so :

$('#container').find('div[data-role=collapsible]').collapsible();

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号