adsense

Wednesday, October 24, 2018

Find checkbox in span using jQuery

jQuery can be used to find and checkbox inside a span as shown below.


<span class="span1" >
        <input id="chkSelect" 
             checked="checked"
             type="checkbox" /></span>

<script type="text/javascript" >
        $(function () {
            $(".span1 input[type='checkbox']").click(function () {
                if ($(this).is(":checked")) {
                    alert("Checked");
                }
                else {
                    alert("UnChecked");
                }
            });
        });
   </script >


No comments:

Post a Comment