S
S
Sergey Nizhny Novgorod2017-07-26 12:01:22
JavaScript
Sergey Nizhny Novgorod, 2017-07-26 12:01:22

How to make preventDefault work in firefox?

Hello everyone
There is such a simple design. But for some reason it does not work in Firefox, there is a standard click. In what way can this be fixed?

<div class="com_cloud">
  <h5 class="com_cloud_text"><a onclick='OpeU()' href="#">Войдите и оставьте свой отзыв</a></h5>
</div>

<script async type="text/javascript">
  function OpeU() {
    event.preventDefault();

    var speed = 1000;

    // место скролла
    var top = $('#scroll_point')

    $('html, body').animate({scrollTop: top}, speed);

    OpenLoginMenu()
    
    }
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alvvi, 2017-07-26
@Terras

onclick='OpeU(event)'

<script async type="text/javascript">
  function OpeU(event) {
    event.preventDefault();

    var speed = 1000;

    // место скролла
    var top = $('#scroll_point')

    $('html, body').animate({scrollTop: top}, speed);

    OpenLoginMenu()
    
    }
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question