locked
Find checkbox in span RRS feed

  • Question

  • User932259438 posted

    <span class="144874717" nameincevent="incevent" data="includeEvent" oddsid="144874717" eventid="9539897"><input id="ContentPlaceHolder1_dlSlip_chkIncludeEvents_0" name="ctl00$ContentPlaceHolder1$dlSlip$ctl00$chkIncludeEvents" checked="checked" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$dlSlip$ctl00$chkIncludeEvents\',\'\')', 0)" type="checkbox"></span>

    This is my code.
    How can I found first class=144874717 and then if chkIncludeEvents is checked="checked"

    I know found only span: $("[nameincevent='incevent'][class='144874717']")

    Thanks

    Sunday, January 15, 2017 8:08 PM

Answers

  • User-271186128 posted

    Hi progy85,

    How can I found first class=144874717 and then if chkIncludeEvents is checked="checked"

    I know found only span: $("[nameincevent='incevent'][class='144874717']")

    You could try to use the following code:

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
        <script type="text/javascript">
            $(function () {
                $(".144874717[nameincevent='incevent'] input[type='checkbox']").click(function () {
                    if ($(this).is(":checked")) {
                        alert("True");
                    }
                    else {
                        alert("False");
                    }
                });
            });
        </script>
    
        <span class="144874717" nameincevent="incevent" data="includeEvent" oddsid="144874717" eventid="9539897">
            <input id="ContentPlaceHolder1_dlSlip_chkIncludeEvents_0" name="ctl00$ContentPlaceHolder1$dlSlip$ctl00$chkIncludeEvents"
                 checked="checked"
                 type="checkbox" /></span>

    More details about the JQuery selectors, I suggest you could check this article:

    http://www.w3schools.com/jquery/jquery_ref_selectors.asp

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 16, 2017 2:22 AM