Me need set item checkbox when i click on element span which have this checkbox.
Code:
First of all, do you want a checkbox or a radio input? Your code is a radio input.
Here is a jsfiddle showing what you require
You need the following javascript:
$('span').click(
function() {
var cb = $(this).find(":radio")[0];
if (!$(cb).attr("checked")) {
$(cb).attr("checked", "checked");
} else {
$(cb).removeAttr("checked");
}
}
);
$('span input').click(
function(event){
event.stopPropagation();
});
change your <span>
s to <label>
with a for=
attribute matching the ID of your input, like so:
<label for="checkbox1">Click Me!</label>
<input type="checkbox" id="checkbox1">
http://jsfiddle.net/2GbPS/
Actually, since you have your checkbox inside the span, this will work:
<label>
<input type="checkbox">
Click Me!
</label>
(fiddle updated)
Works with radios too!
<label>
<input type="radio">
Click Me!
</label>
$('.CheckMemberClassList').bind('click',function(){
$('.CheckMemberClassList').removeClass('MemberClassActive').addClass('MemberClassInactive');
$(this).removeClass('MemberClassInactive').addClass('MemberClassActive');
$(this).find('input:radio').prop('checked', true);
});
Working Example: http://jsfiddle.net/hMYtg/
Jquery .prop() Documentation: http://api.jquery.com/prop/