Jquery error on click slide down

依然范特西╮ 提交于 2019-12-11 07:46:51

问题


I am trying to get a box to drop down on the click of a link. This is my JS function

<script language = 'javascript'>
      function toggleInteractlogin(x)
               {
    if($('#' + x).is(":hidden"))
    {
       $('#'+x).slideDown(200);
      }
      else
     {
    $('#'+x).hide();
    }
    $('Interactlogin').hide();


    }
    </script>

Whenever i click on the actual link itself nothing slides down.

 <div class='buttons'><a href  = '#' onclick = "return false" onmousedown =         "javascripttoggleInteractlogin('login')"class='regular' name='save'> Log In </div></a>

Any help is appreciated


回答1:


there should be a : between javascript and function name as below

javascript:toggleInteractlogin('login');



回答2:


</div> is closed in wrong position

EDIT:

Change this html

<div class='buttons'><a href  = '#' onclick = "return false" onmousedown =         "javascripttoggleInteractlogin('login')"class='regular' name='save'> Log In </div></a>

to this html

<div class='buttons'>
    <a href='#' onclick="return false" onmousedown="javascripttoggleInteractlogin('login')" class='regular' name='save'>Log In</a>
</div>


来源:https://stackoverflow.com/questions/9366726/jquery-error-on-click-slide-down

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!