JSFiddle - React, Tailwind, and code Playground
by Karan1412
HTML
<html>
<head>
<title>slideToggle</title>
</head>
<body>
<input type="button" id="buttonOpen" value="Open"/><br>
<fieldset id="form">
<legend>Form</legend>
<table>
<tr>
<td><label>Name:</label></td>
<td><input type="text" id="txtName"><td>
</tr>
<tr>
<td><label>Age:</label></td>
<td><input type="text" id="txtAge"><td>
</tr>
<tr>
<td><label>Address:</label></td>
<td><input type="text" id="txtAddress"><td>
</tr>
</table>
</fieldset>
</body>
</html>
CSS
fieldset
{
width:300px;
margin-left:100px;
display:none;
}
#buttonOpen
{
margin-left:190px;
width:100px;
}
JavaScript
$(document).ready(function () {
$("#buttonOpen").click(function () {
$("#form").slideToggle("slow", function () {
changeButtonValue();
})
})
});
function changeButtonValue() {
var name = $("#buttonOpen").val();
if (name == 'Open') {
$("#buttonOpen").val('Close');
}
else {
$("#buttonOpen").val('Open');
}
}