locked
how to delete selected checkbox in jquery using asp.net RRS feed

  • Question

  • User1574312291 posted

    hello please send  me code for deleting selected checkboxes with button delete

    Monday, May 7, 2018 2:25 PM

All replies

  • User-369506445 posted

    hi

    please try below code :

    <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
    <script>
        $(function() {
            $("#btn").click(function() {
                
                $('input[type=checkbox]').each(function () {
                    if (this.checked)
                        $(this).remove();
                });
            });
        });
    </script>
    <input type="checkbox" /><br />
    <input type="checkbox" /><br />
    <input type="button" value="delete" id="btn"/>

    Monday, May 7, 2018 3:52 PM
  • User61956409 posted

    Hi syedtalib46,

    syedtalib46

    please send  me code for deleting selected checkboxes with button delete

    The :checked selector could help us quickly and easily find the checked checkbox(es), you can refer to the following sample code to find and remove all selected checkboxes.

    $("#btndelete").click(function () {
        $("input[type='checkbox']:checked").remove();
    })

    Note: using the .remove() method will remove the set of matched elements from the DOM, if you want to dynamically hide (then show them) elements, you can use the .hide() method.

    With Regards,

    Fei Han

    Wednesday, May 9, 2018 8:17 AM