DonOfDen
DonOfDen

Reputation: 4088

Issue with this in Jquery 1.10.1

I am working with Jquery 1.10.1 for multiple check box select.

Check the fiddle link: http://jsfiddle.net/HBGzy/68/

It works fine when I use JQuery 1.6.4 but I am using JQuery 1.10.1 I tried different methods but now use:

It works fine in some condition when I use the below code:

function Checkboxall(valueclass) {
  alert('#'+valueclass);
    var chk = $('#'+valueclass).is(':checked')?true:false;
    alert(chk);
    $('.chk_boxes1').attr('checked',chk);
  }

Like Onclick=" Checkboxall(chk_boxes)"

But only once I can use per page load. Can some one help me in solving the issue?

Upvotes: 0

Views: 423

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

it is as simple as (please read the documentation for .prop() to understand the difference between .attr() and .prop())

$('.chk_boxes').click(function(){
    $('.chk_boxes1').prop('checked', this.checked);
});

Demo: Fiddle

Upvotes: 4

Related Questions