Hello
There is a button of this type:

<div class="log-in"><img src="{THEME}/images/log-in.png" alt="log-in" /><a href="">Войти</a></div> 

And the panel that when you press the button should go:

 <div class="panel"> <form method="post" action=""> <label for="login_name">{login-method}</label><input type="text" name="login_name" id="login_name" /> <label for="login_password">Пароль (<a href="{lostpassword-link}">Забыли?</a>):</label><input type="password" name="login_password" id="login_password" /> <button class="fbutton" onclick="submit();" type="submit" title="Войти"><span>Войти</span></button> <input name="login" type="hidden" id="login" value="submit" /> <a href="{registration-link}">Регистрация</a> </form> </div> 

CSS:

 .panel{width:200px; height:150px; background:#F00; display:none;} 

jQuery:

 <script type="text/javascript"> $(document).ready(function () { $(".log-in").click(function(){ $(".panel").slideToggle("slow"); return false; }) }); </script> 

The problem is that when the button is .panel , the panel opens, but when the input field is .panel inside the .panel , it is hidden again. Help please, or write how to make a script correctly.

    2 answers 2

    Honestly, I couldn’t check - your example works for me as you wanted. See http://jsfiddle.net/chernomyrdin/rtkVQ/ . Most likely there are some other handlers that close the panel. From the banal recommendations, I would advise to remove display:none; from CSS and add it to <div class="panel" style="display:none">

    • +1, litter when I started writing my answer, yours was not there yet. - invincible
    • I tried, not rolled ( - Wars
    • It feels like something else is happening, is there any other jquery / javascript code on the page? And in what version of the browser is it testing? - chernomyrdin
    • Everything, figured out) I, it turns out, the {login} tag was in div.log-in , that is, when I clicked on this div it was hidden. Thanks for answers. - Wars
    • As I said, the closing tag was not standing there. - invincible

    Well, at first glance it should work at all. But try, for example, instead of:

     $(".log-in").click 

    use

     $("#log-in").click 

    In general, you need to look at the whole code. Maybe you have somewhere a closing tag is missing.

    • Everything is correct $(".log-in").click as <div class="log-in"> and id is not there - chernomyrdin
    • :) good joke. Well, it is clear that this is correct, but who will guarantee that he has the same class, for example, does not hang on his body? <body class = "log-in"> - invincible