Hide an html element using javascript only if browser is firefox

前端 未结 6 1765
没有蜡笔的小新
没有蜡笔的小新 2021-01-05 07:28

How can I hide a div with javascript if the browser is firefox only?

6条回答
  •  孤城傲影
    2021-01-05 08:06

    You might try Rafeal Lima's CSS Browser Selector script. It adds a few classes to the HTML element for OS, browser, js support, etc. You can then use these classes as hooks for further CSS and/or JS. You might write a CSS (or jQuery) selector like html.gecko div.hide-firefox once the script has run.

提交回复
热议问题