Js onclick method does not work in Firefox

defines an onclick, that works in both Edge and chrome, but Firefox gg, just self-taught the front end of the web page, but also look forward to your advice, thank you!

</i>
</div>
function searchToggle() {
    if(main.hasClass("search-open")) {
        main.removeClass("search-open");
        $(".search-input").val("");
        $("-sharplocal-search-result").empty();
    } else {
        main.addClass("search-open");
        $(".search-input").val("");
        $("-sharplocal-search-result").empty();
        scrollTo(0,0);
    }
}

the original method name is sidebarToggle () . I thought it was the reason for the method name, and then changed it. I also tried to put the js directly behind the element, but it didn"t work, because I thought about it all alone, so I didn"t write the specification. I hope the seniors can give me some advice.

Mar.23,2021
Under

Firefox, the click events of the child elements in button are blocked, so the span clicks in your button are not valid, but the I clicks in div are valid.
if you need span to have click effect, change button to div , and you can add button style to div .

Menu