jquery gets all the checked checkbox values

Use [type=checkbox] to select inputs of type checkbox. Also, since [] are illegal characters in unquoted selector values, surround them in quotes: [name='type[]']

$('button').on('click', function() {
  var array = [];
  $("input[type=checkbox][name='type[]']:checked").each(function() {
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js">

<input type="checkbox" name="type[]" value="GFG" id="feaut" /> GFG:
<input type="checkbox" name="type[]" value="Geeks" id="feaut" /> Geeks:
<input type="checkbox" name="type[]" value="Geek" id="feaut" /> Geek:
<input type="checkbox" name="type[]" value="portal" id="feaut" /> portal:
        click here 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top