jquery mobile - Jquerymobile buttons are shown only first apperance of the page -


i have problem jquery mobile code. using code above append dynamic html code application.

$("#tab3").click(function() {     $('#habericerik').html(" <img src='img/izto_header.png' height=auto width=100% class='img2'  > ");     $('#habericerik').append("  <div class='zoomtab'><a href='#' data-role='button' class='plus'>+</a><a href='#' data-role='button' class='minus'>-</a></div>"); }); 

when page loads first, works perfectly. when move main page , click tab3 page again buttons shown links,not button styles.

can me solve problem?

in code you're not refreshing button's styles. so, must add after append()

  $(document).on("click", "#tab3", function (e) {         e.preventdefault();         $('#habericerik').html("<img src='http://www.ndaccess.com/sample/images/image1.jpg' height=auto width=100% class='img2' > ");         $('#habericerik').append("<div class='zoomtab'><a href='#' data-role='button' class='plus'>+</a><a href='#' data-role='button' class='minus'>-</a></div>").promise().done(function () {             //wait till appended             $(this).find("a").buttonmarkup("refresh");         });     }); 

for more info see docs : http://api.jquerymobile.com/button/#method-refresh

and here's demo : http://jsfiddle.net/hungerpain/ctdkn/


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -