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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -