Based on the information here: change dropdown button text on dropdown items selection I am wondering if this code can be modified to take into account a page reload.
I am attempting to get the text from the dropdown link clicked on to stay in the dropdown button on refresh.
$(".btn-toggle").on("click", function() {
$('.dropdown-menu').toggleClass('open');
});
$(".dropdown-menu li").on("click", function() {
$('.btn-toggle').text($(this).text());
$('.dropdown-menu').removeClass('open');
});
This works well as long as there is no page reload.