It is necessary to make it so that when you click on #block1 , .block2 and disappears. You need to do this on jquery.

Closed due to the fact that off-topic participants Vladyslav Matviienko , ermak0ff , GrayHoax , Spawn , torokhkun 17 Nov '15 at 12:57 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • " Questionnaires are forbidden on Stack Overflow in Russian . To get an answer, rephrase your question so that it can be given an unambiguously correct answer." - Vladyslav Matviienko, ermak0ff, Spawn
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    .block2 should disappear by itself or after the next click? - tutankhamun
  • After the next click - Ezdrael
  • Would you even try yourself. And that sounds like a technical task on fl.ru - Mik
  • very happy for you. What is the problem? - Vladyslav Matviienko
  • one
    I vote for the closure of this issue as not relevant, because the author should try to solve the problem on his own, and not ask to solve the problem for him! - GrayHoax

1 answer 1

This is an almost canonical example of jQuery . You can say Hello, world on jQuery .

 $('#block1').on('click', function() { $('.block2').toggle(); }); 

Much more interesting is the task (which is often found) of displaying and hiding a neighboring element or element that is in the same container with the “button”

See also:

  • I have to do something like this: block1.click (function () {if (block2 is visible) {} block2. Hide} otherwise {block2. Show}); - Ezdrael
  • I did not just give links. Look at the parameters of the toggle() method, in particular the last option. - tutankhamun
  • Good, thank you. I just just learn to program and I don’t even know how I can search for it in Google only in my own words. - Ezdrael
  • @Ezdrael Read, at least fluently, jQuery documentation or find its translation if it is difficult to read in English. You can also search for textbooks in Russian. Only you need to understand that they are often written for old versions, but the general approach has been preserved. - tutankhamun
  • Thank you for your search, I already found the Russian version of jquery-docs.ru/Effects/toggle - Ezdrael