In my ruby application, i want my modal to be opened after a page reload..
I have tried the follwing code...
:javascript
$(document).ready( function() {
$(".minus").click(function(){
location.reload();
$('#memberModal').modal('show');
});
} );
Please help me with a solution..
Thanks in advance
You cannot call modal after location.reload()
because the page is deconstructed.
I would recommend adding not using reloading.
If you really want to, try adding attribute to location and open modal according to it.
$(".minus").click(function(){
// change it according to your use case
document.location = document.location + "#memberModal";
}
$(document).ready(function(){
if (window.location.hash != null){
$(window.location.hash.substr(1)).modal('show');
}
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.