enter image description here

Why is the script not working?

<script> $(document).ready(function(){ $("activatemenu").click(function(){ $("topmenu").animate({ height:'10rem' }); }); </script> 

HTML:

 <div class="activatemenu"> <i class="fa fa-bars"></i> <p class="mobiletext">Menu</p> </div> 

Menu block:

 <div class="topmenu"></div> 

I need that when I click on div.activatemenu, the size of .topmenu becomes 10rem Explain to the person that I just started learning JS, thanks in advance c:

  • 1) you can attach and css. 2) all code (js html css) can be placed in a snippet in order to at least somehow give a minimal reproducible example 3) you don’t have one more in js }); - is it so conceived? - Alexey Shimansky
  • @ Alexey Shimansky on JSFiddle a little? - user234223
  • Links to other sources may be outdated, deleted, inaccessible. And besides, it is necessary to go there, to open something. On ruSO specially made snippets (in any case for js, css, html) so that you can put the code directly there. A link to jsfiddle can be attached as an addition to the code already posted here. - Alexey Shimansky
  • describe at least as it should be - kizoso

1 answer 1

You have jQuery syntax error. Try to put in front of the activatemenu and topmenu points, as in css, to indicate that these are classes.

  • Egor, isn't there a dot somewhere? I do not see the error in emphasis: c - user234223
  • @ user234223, I returned the original version of the question. If you have a new question, ask it separately. - Grundy
  • @Grundy but the salt is that I asked for a new one - and it was automatically changed by a stupid one - user234223
  • @ user234223, this is not possible. Try asking again. Here is this link - Grundy
  • @ user234223 Please describe in detail what exactly happened to your question in a publication on the Met . - Nicolas Chabanovsky