jquery - Set toggle on an image -


The code below has been changed to toggle

@item ["name"], but the dropdown is now instead of a bar Displays all items (5 entries).

How can I change it

  & lt; Script & gt; $ (Document) .ready (function () {$ (".name") Click (function () {$ (". Dropdown"). FadeToggle ("slow");});}); & Lt; / Script & gt; & Lt; Table class = "diag" style = "background: url ('.png'); boundary: none" & gt; & Lt; Tbody & gt; @Fouranchatch (Miscellaneous items in model. Model) {@: & lt; Tr & gt; & Lt; Td square = "picture" & gt; & Lt; Img src = "@ item [" image "]" /> & Lt; / TD & gt; & Lt; Td class = "name" & gt; @ Etem ["name"]  & Lt; Td square = "dropdown" & gt; & Lt; Ul & gt; & Lt; Li & gt; Option 1 & lt; / Li & gt; & Lt; Li & gt; Option 2 & lt; / Li & gt; & Lt; Li & gt; Option 3 & lt; / Li & gt; & Lt; Li & gt; Option 4 & lt; / Li & gt; & Lt; Li & gt; Option 5 & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / TD & gt; @: & Lt; / TR & gt; } & Lt; / Tbody & gt; & Lt; / Table & gt; 

Since you are not providing enough information, this time the best selector is: < / P>

  $ (document) .ready (function () {$ ("td.image img"). Click (function () {$ ("p"). Toggle ();}) ;}); Edit: Depending on the HTML you have added, you need to use:  
  $ (document) .ready ( Function () {$ ("Td.image img") (function () {$ (this) .closest ('Picture'). Sister ('. Dropdown') Toggle ();}); );  

Comments