I need to create a functionality where clicking a button will display a panel. Initially, I have set the panel's visibility to false in its properties. So, when the user clicks the button, the button should hide and the panel should show up. How can I implement this using jQuery?
This is what I've attempted so far:
$(document).ready(function () {
//$('#PanelRegisterForm').hide();
$('#btnRegister').click(function () {
$('#btnRegister').fadeOut("slow", function(){
//$('#PanelRegisterForm').attr("visibility","visible");
//$('#PanelRegisterForm').fadeIn("slow");
//$('#PanelRegisterForm').show();
$('#PanelRegisterForm').css("visibility", "visible");
});
})
});
<div class="container container-max-width">
<div class="row">
<div class="panel ">
<div class="" style="text-align:center;padding-top:50px;">
<button type="button" class="btn btn-info btn-md" id="btnRegister" >Register</button>
</div>
<asp:Panel ID="PanelRegisterForm" class="panel-body" runat="server" Visible="False">
<div class="form-group">
<h2 style="text-align: center;">Register</h2>
</div>
... (remaining code) ...
</asp:Panel>
</div>
</div>
</div>
Initially, I tried to hide the panel using jQuery like $('#PanelRegisterForm').hide();
. However, this caused flickering when the page loaded. For this reason, I adjusted the visibility to false.
While the button successfully fades out when clicked, the panel does not become visible as expected.
Thank you