2013-04-22 24 views

回答

0

id屬性指定一個HTML元素的唯一ID(該值在HTML文檔中必須是唯一的)。

您可以使用ID的類(CLASS = 「rbl_poll」)insread(ID = 「rbl_poll」)

<asp:RadioButtonList class="rbl_poll" runat="server"></asp:RadioButtonList> 

而改變腳本

if ($(".rbl_poll").length == 0) { 
    $("#div_poll_box").hide(); 
} 
0

嘗試在列表中選擇的單選按鈕項目:

if ($("#rbl_poll input:radio").length == 0) { 
    $("#div_poll_box").hide(); 
} 
0

$("#rbl_poll").length應該始終爲1,因爲有應該只有一個元素與唯一 ID rbl_poll

你需要自行選擇id="rbl_poll"元素中的元素descendent,例如用

if ($('#rbl_poll input[type="radio"]') === 0) { 
    $('#div_poll_box').hide(); 
} 
相關問題