라디오 단추 목록 값이 'N'이면 Label 컨트롤을 표시/숨기려고합니다. 코드는 제대로 작동하지만 라디오 버튼을 선택 취소하면 Label 컨트롤이 숨겨지지 않습니다. 또한 Jquery mousedown 이벤트를 사용하여 선택을 지우고 있습니다. 제발 제안 해주세요.Radiobuton 목록 표시 숨기기 레이블 컨트롤
var radioList = "#<%= radioLst1.ClientID %>";
var lblID = document.getElementById('<%=LblIDNumber.ClientID%>');
$(radioList + " input:radio").click(function (e) {
if ($('#<%= radioLst1.ClientID %> input:checked').val() == "N") {
lblID.style.display = $(this).attr("checked") ? 'inline' : 'none';
}
else {
lblID.style.display = 'none';
}
});
나는 라디오 버튼 목록의 선택을 취소하려면 다음 코드를 사용하고 있습니다.
$(radioList + " input:radio").mousedown(function (e) {
if ($(this).attr("checked") == true) {
setTimeout("$('input[id=" + $(this).attr('id') + "]').removeAttr('checked');", 200);
lblID.style.display = 'none';
}
else {
return true
}
});
<asp:Label ID="LblIDNumber" style="display:none" runat="server">Number</asp:Label>
<asp:RadioButtonList ID="radioLst1" runat="server">
<asp:ListItem Value="U">Unknown</asp:ListItem>
<asp:ListItem Value="N">Not Applicable</asp:ListItem>
</asp:RadioButtonList>