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

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -