checklist: replace inArray on loop with non-strict comparison
This commit is contained in:
@ -71,11 +71,17 @@ $(function(){
|
|||||||
var $checks = this.$input.find('input[type="checkbox"]');
|
var $checks = this.$input.find('input[type="checkbox"]');
|
||||||
$checks.removeAttr('checked');
|
$checks.removeAttr('checked');
|
||||||
if($.isArray(value) && value.length) {
|
if($.isArray(value) && value.length) {
|
||||||
$checks.each(function(i, el) {
|
$checks.each(function(i, el) {
|
||||||
if($.inArray($(el).val(), value) !== -1) {
|
var $el = $(el);
|
||||||
$(el).attr('checked', 'checked');
|
// cannot use $.inArray as it performs strict comparison
|
||||||
}
|
$.each(value, function(j, val){
|
||||||
});
|
/*jslint eqeq: true*/
|
||||||
|
if($el.val() == val) {
|
||||||
|
/*jslint eqeq: false*/
|
||||||
|
$el.attr('checked', 'checked');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user