嘿,我正在尝试从代码中的标签中获取值:
<div id="chkHaz" data-checked="no">
<asp:Label ID="lblchkHaz" runat="server" Text="no" ClientIDMode="Static" Style="visibility: hidden; display: none;"></asp:Label>
<asp:Image ID="check_chkHaz" runat="server" ImageUrl="~/images/chkOFF.png" ClientIDMode="Static" />
</div>
我根据用户是否通过 JQuery “检查”了它来设置它:
$("#chkHaz").click(function (input) {
if ($(this).attr("data-checked") == "no") {
$('#check_' + $(this).attr('id')).attr("src", "/images/chkON.png");
$(this).attr("data-checked", "yes");
$('#lbl' + $(this).attr('id')).attr("text", "yes");
$('#lbl' + $(this).attr('id')).html("yes");
} else {
$('#check_' + $(this).attr('id')).attr("src", "/images/chkOFF.png");
$(this).attr("data-checked", "no");
$('#lbl' + $(this).attr('id')).attr("text", "no");
$('#lbl' + $(this).attr('id')).html("no");
}
});
但是,当我通过后面的代码检查它时:
Dim strChkHaz As String = lblchkHaz.text & ""
即使我知道它将“no”的HTML 值更改为“yes”并且将“text”从“no”更改为“ yes”,它始终是“no ”
更改为...