Hi guys i am confused why have different result in my code. In "var rq" i just have one true alert ( just ir have true value). In first alert i have "ir" and its true but with second alert its shown "rj" and its not true !! what happen here can someone tell me? how i can fix that.
$('#friends').removeAttr('checked').on('click', function(){
var rq = {
"mr" : $('li#mr a').attr("aria-expanded"), // false
"ir" : $('li#ir a').attr("aria-expanded"), // true
"rj" : $('li#rj a').attr("aria-expanded") // false
};
if(this.checked) {
for (var i in rq) {
if ( rq[i] == "true"){
alert(i); // alert ir
$('#checkAll-'+i).change(function () {
alert(i); // alert rj
$( 'input:checkbox[id='+i+'-checkbox]' ).prop( "checked", true );
});
}
}
}
)}
EDITE
HTML:
<input name="form-field-radio" type="radio" id="checkAll-ir" class="ace">