Greetings, the answers that I looked here and in the search engines did not help me.

I have a form

<form class="form-inline" id="editName"> <input type="text" class="form-control" name="first" placeholder="Имя"> <input type="text" class="form-control" name="first" placeholder="Фамилия"> <button type="submit" class="btn btn-default">Сохранить</button> </form> 

I need to show it or hide it by clicking on the link. By default, it should be; I tried the options from the first three pages of Google.

Does not work

 $("#editorName").click(function() { $(this).find("form#editName").toggle(); }); 
  • and than toggle () does not suit? - Konst
  • @Konst I speak does not work. - donttime
  • $ ("# editorName"). click (function () {$ ("# editName"). toggle ();}); - Konst

1 answer 1

Here's a solution for you, I think where will you figure it out.

  $( "#button-slide-l" ).click(function() { if ( $("div.content").hasClass("close") == true ) { $('div.content').removeClass('close'); } else { $('div.content').addClass('close'); } });