Refresh popup content in jQuery mobile
In the jQuery mobile popup, enter some text and refresh the current page using changePage . After that open the open one, it will show up in the text box that I entered earlier. How to update the popup (Please don't suggest an empty textbox value).
Code:
localStorage.setItem("name","tiger");
$(document).on("click","#save",function(){
$("#openpopup").popup("close");
localStorage.setItem("name",$("#pText").val());
$.mobile.changePage("#page1",{
allowSamePageTransition : true,
transition : 'none',
});
});
$(document).on("pageshow","#page1",function(){
if(localStorage.getItem("name")){
$("#name").val(localStorage.getItem("name"));
}
});
Here is the FIddle
+3
source to share