I have a list of places shown on a page. I also have a search form and button for that list. My issue is that the list is visible by default. I’d like the list — filtered via search — to be shown only once the search is conducted. While staying on the same page. I have the following code. The list is initially hidden well enough. But when I click on the search button, the list shows for 0.1 second and the disappears. I think I have something wrong here — I’d really appreciate help.
JS
document.getElementById("place_list").style.display = "none";
function showPlace() {
document.getElementById("place_list").style.display = "block";
}
Search button
<%= submit_tag("Search", name: nil, zip: nil, onclick:"showPlace()", class:'', style:'', id:"") %>