[英]How can I make certain fetch data appear after pressing a button. Using JavaScript and HTML
[英]How can I make a certain row appear even after reload using jquery?
我的jQuery似乎工作正常。 但是每次頁面刷新時,“ row1”都會消失。 但是該復選框仍處於選中狀態。
重新加載后如何使“ row1”出現? 謝謝
$(document).ready(function() { $("#chk1").click(function() { if ($(this).is(':checked')) { $("#row1").show(); } else { $("#row1").hide(); $('#tbshow').val(""); } });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <label for="chk1"> <input type="checkbox" id="chk1" value="1" runat="server" clientidmode="Static" />Show </label> <asp:TableRow ID="row1" runat="server" Style="display: none" ClientIDMode="Static"> <asp:TableCell> <asp:Label ID="lblshow" runat="server" Text="Show"> </asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="tbshow" runat="server" ClientIDMode="Static"></asp:TextBox> </asp:TableCell> </asp:TableRow>
我將您的就緒函數更改為:
$(document).ready(function() {
if ( $("#chk1").prop("checked") ) {
$("#row1").show();
}
$("#chk1").click(function() {
if ($(this).is(':checked')) {
$("#row1").show();
} else {
$("#row1").hide();
$('#tbshow').val("");
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.