I have the following html code:-
<!DOCTYPE html>
<html>
<body>
<fieldset>
<legend>
<button>
Show/Hide form
</button>
</legend>
Name:
<input type="text" />
<br />
Email:
<input type="text" />
<br />
Date of birth:
<input type="text" />
</fieldset>
<fieldset>
<legend>
<button>
Show/Hide form
</button>
</legend>
Name:
<input type="text" />
<br />
Email:
<input type="text" />
<br />
Date of birth:
<input type="text" />
</fieldset>
<fieldset>
<legend>
<button>
Show/Hide form
</button>
</legend>
Name:
<input type="text" />
<br />
Email:
<input type="text" />
<br />
Date of birth:
<input type="text" />
</fieldset>
</body>
</html>
But how i can show and hide a field set if the user clicks on the “show/hide form” button AND is there a way to change the button label to be either show or hide based on the current status of the field set?
BR
When
fieldsetis hidden your button is hidden too. You can modify your markup and usetogglemethod: