Scroll not work in this code

Discussion in 'jQuery' started by mehr_83, Oct 16, 2013.

  1. #1
    Hi,

    i use this code

    <script type="text/javascript">
            $(document).ready(function () {
                $('[id$=insbtn]').click(function () {
                    $('html,body').animate({ scrollTop: $('#one').offset().top }, 'slow');
                    return false;
                });
            });
        </script>
    Code (markup):
    But, when i click other button before click of insbtn, this is not work, please help me,
     
    mehr_83, Oct 16, 2013 IP
  2. chifliiiii

    chifliiiii Active Member

    Messages:
    31
    Likes Received:
    3
    Best Answers:
    3
    Trophy Points:
    55
    #2
    Try using $('#insbtn') and that you only have one button with that ID
     
    chifliiiii, Oct 17, 2013 IP