user1748687
user1748687

Reputation: 11

JqueryMobile lose the style after append

Can somebody help me with this

http://jsfiddle.net/wwRNh/52/

How can I append an element and preserve its style ?

I have tried $(....).trigger(create);

Thanks

Upvotes: 1

Views: 483

Answers (1)

Littm
Littm

Reputation: 4947

Trigger the refresh event of the listview, just after appending your object, by using:

$("ul").listview("refresh"); 

You should then have the following JS code:

$(document).ready(function(){
    $("#btn1").click(function(){

        $("ul").append("<li><a href="+"#page2"+">Page Two</a></li>");

        // Trigger refresh event
        $("ul").listview("refresh"); 

    });
});

Upvotes: 2

Related Questions