how to get multiple checkbox value using jquery

前端 未结 12 782
终归单人心
终归单人心 2020-11-29 20:11

How can I get the value of checkboxes which are selected using jquery? My html code is as follows:



        
12条回答
  •  广开言路
    2020-11-29 20:30

    Try this, jQuery how to get multiple checkbox's value

    For Demo or more Example

        $(document).ready(function() {
            $(".btn_click").click(function(){
                var test = new Array();
                $("input[name='programming']:checked").each(function() {
                    test.push($(this).val());
                });
     
                alert("My favourite programming languages are: " + test);
            });
        });
    
    
    
    
    jQuery Get Values of Selected Checboxes
     
    
    
        

    Select your favorite Programming Languages :


提交回复
热议问题