locked
screenreader did not read the dropdownlist checkboxlist RRS feed

  • Question

  • User-944424728 posted

    Hello, I got it to work but now I have a checkbox list that did not read the label.  Please advise. thanks.

    --

    <td style="color:#c20000;width:5px;">
    <asp:Label ID="lblResponseRequired" runat="server" Visible='<%#Eval("col_responserequired")%>' CssClass="required">*</asp:Label>
    </td>
    <td style="width:230px;">
    <asp:Label ID="lblQuestion" runat="server" CssClass="HPRfontbold" Text='<%# Eval("col_question")%>'></asp:Label>
    </td>
    <td>


    <asp:View ID="View5" runat="server">
    <asp:CheckBoxList runat="server" ID="ddlQuestionAnswer5" CssClass="clsQuestion"></asp:CheckBoxList>
    <br />
    <asp:Panel ID="phverify5" runat="server"></asp:Panel>
    </asp:View>

    --

    $(function () {

    $('.clsQuestion').each(function (i) {
    var eid = $(this).prop('id');
    var lblid = $(this).closest('tr').find('span').attr('id');
    if ($('#' + lblid).hasClass('required')) {
    var lblReqid = $('#' + lblid).closest('td').next('td').find('span').attr('id');
    //alert($('#' + lblReqid).text());
    $('#' + lblReqid).css({ 'color': 'DarkOrange' });
    $('#' + eid).attr('aria-labelledby', lblReqid);
    }
    else {
    //alert($('#' + lblid).text());
    $('#' + lblid).css({ 'color': 'darkgreen' });
    $('#' + eid).attr('aria-labelledby', lblid);
    }
    });

    });

    --html code

    <td wiid="C1325"><input id="ctl00_Main_content_ucApplicationQuestions_gridApplicationQuestions_ctl19_ddlQuestionAnswer5_1" type="checkbox" name="ctl00$Main_content$ucApplicationQuestions$gridApplicationQuestions$ctl19$ddlQuestionAnswer5$1" wiid="C1326"><label for="ctl00_Main_content_ucApplicationQuestions_gridApplicationQuestions_ctl19_ddlQuestionAnswer5_1" wiid="C1327">no</label></td>

    Wednesday, July 17, 2019 8:35 PM

All replies

  • User839733648 posted

    Hi aspvbnet,

    According to your description and code, I'm sorry that I could not reproduce your issue and I'm not so clear about your issue.

    I got it to work but now I have a checkbox list that did not read the label.

    What does the "it" in "I got it to work" mean?

    There is a checkboxlist(ID="ddlQuestionAnswer5") and checkbox( id="ctl00_Main_content_ucApplicationQuestions_gridApplicationQuestions_ctl19_ddlQuestionAnswer5_1" ).

    I'm confused about the connection between them. And which chckbox do you mean?

    If possible, please provide the complete code which could reproduce your issue so that this will be easier to help with you.

    Besides, I've made a demo about how to read the checkboxlist's value and hope it could be helpful to you.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    <script type="text/javascript">
    window.onload = function () {
    var obj = document.getElementById('<%= CheckBoxList1.ClientID %>');
    for (var r = 0; r < obj.rows.length; r++) {
    var varCheckBox = obj.rows[r].cells[0].childNodes[0]
    if (varCheckBox) {
    varCheckBox.onclick = function () {
    if (this.checked)
    alert(this.parentNode.childNodes[1].innerText)
    }
    }
    }
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:CheckBoxList ID="CheckBoxList1" runat="server">
    <asp:ListItem Value="0">Item 1</asp:ListItem>
    <asp:ListItem Value="1">Item 2</asp:ListItem>
    <asp:ListItem Value="2">Item 3</asp:ListItem>
    </asp:CheckBoxList>
    </form>
    </body>
    </html>

    Best Regards,

    Jenifer

    Thursday, July 18, 2019 2:23 AM