I have a table which consist of user added data. All the 's added are added with a equal button. Like this:
<td> <form action="newBet.jsp" method="get"> <fieldset> <input class="button betButton1" id="Won" type="submit" name="W" value="✔"/> <div class="closeEarlyForm" style="display:none;"> <input class="form-control" name="update1" type="number"/> <input class="button betButton1" type="submit" name="update" value="Close early"/> </div> <input class="closeEarlyLink" type="button" value="✎ Close early?"/> </fieldset> </form> </td> This wokrs fine. Now, I want to add some jquery which toggle the hidden div element. This is where I run into troubles. I can't seem show the div element only on the clicked element. Instead it shows the hidden div element on all the td's.
$(document).ready(function(){ $(".closeEarlyLink").click(function(e){ e.preventDefault(); $(".closeEarlyForm").fadeToggle(); }); }); I know that my problem is that I select all the elements with the class, but I cant figure out how to only toggle/select the hidden element on the specific td.