I have this specific class called:
.mapboxgl-ctrl-geocoder {
font-size: 18px;
line-height: 24px;
font-family: "Open Sans", "Helvetica Neue", Arial, Helvetica, sans-serif;
position: relative;
background-color: #fff;
width: 100%;
min-width: 240px;
z-index: 1;
border-radius: 4px;
transition: width .25s, min-width .25s;
right: 900px;
visibility: hidden;
}
The current visibility is set to 'hidden', but I aim to change it to 'visible' when clicked upon:
function search() {
document.getElementsByClassName('mapboxgl-ctrl-geocoder')[0].style.visibility = "visible";
}
Additionally, this action should be triggered by clicking on the following link:
<a onclick="search()">Search</a>
Despite implementing these steps, the functionality does not seem to be working correctly. I am unsure of what the issue might be. Any suggestions on how to resolve this? Please note that I have confirmed that .mapboxgl-ctrl-geocoder
pertains to an element with the class name and not an ID. Thank you for your assistance!