How to select and unselect all value inside in Select2 dropdown by using Select All Checkbox.

1,022 views
Skip to first unread message

Bagavath PA

unread,
Jan 8, 2015, 10:55:48 AM1/8/15
to sel...@googlegroups.com
 I am Using this code...

My code is..


  <script type="text/javascript">

        $("#lbx_FundType").select2();
        $("#checkbox").click(function () {
            if ($("#checkbox").is(':checked')) {
                $("#lbx_FundType > option").prop("selected", "selected");
                $("#lbx_FundType").trigger("change");
            } else {
                $("#lbx_FundType > option").removeAttr("selected");
                $("#lbx_FundType").trigger("change");
            }
        });
      </script>
     <script type="text/javascript">



 <input type="checkbox" runat="server"  onchange="return CheckChanged(event);" id="checkbox" />Select All 
             <select  id="lbx_FundType" class="chzn-select span4" runat="server"> </select>


Reply all
Reply to author
Forward
0 new messages