javascript - Getting the value of current checkbox from a group of checkboxes with same class name -


i'm trying value of current checkbox group of checkboxes same class name below. jquery code seems not acting out accordingly. me out this?

http://jsfiddle.net/m8fdc/2/

html

<input type="checkbox" class="checkbox1" value="test"/><br /> <input type="checkbox" class="checkbox1" value="test2"/> <br /> <input type="checkbox" class="checkbox1" value="test3"/>  

js

$(document).ready(function() {     //set initial state.      $('.checkbox1').click(function() {         if ($(this).is(':checked')) {             console.log($('.checkbox1').val());         }     }); }); 

any appreciated!

thank you.

is:

$('.checkbox1:checked').val() 

what looking for?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -