html - How to use Toggle button jQuery in <div main..> -


I'm trying to hide / show the toggle using jQuery. But when I clicked, there was no incident.

  & lt; Script & gt; $ (Document) .ready (function () {$ ("button"). Click (function () {var main = this.value; $ ("#" + main) .slideToggle ();})}} ; & Lt; / Script & gt;  

A div :

  & lt; Div id = "main" & gt; @RenderBody () & lt; Button & gt; Toggle & lt; / Button & gt; & Lt; / Div & gt; Can anyone tell me what happened to these lines of code?   

Your button has no value attribute, such as you want:

 $ {Document} .ready (function () {$ ("button") Click (function () {$ ("# main"). Slide toggle ();});});  

Comments

Popular posts from this blog

scala - Play Framework - how to bind form to a session field -

Django Celery - running scheduled tasks -

perl - 'Unquoted string ".." may clash with future reserved word' but only when package is used -