There is a link <a href="#" onclick="js"><img="path"></a> to open the menu in the mobile version of the site, the problem is that when you click on the link, it ends up with the url page ending with / # , but you just need to open the menu. How to make a blank link?

  • Do you have to use <a> ? You can also handle click on <span> - htmlcoder

1 answer 1

in the function to prohibit the default action

 <a href="#" onclick="menu_open(e)"><img="path"></a> <script> function menu_open(e) { //код //запрещаем переход по ссылке e.preventDefault(); } </script>