How to use toggle function in a for loop
I am using toggle function totally 20 toggles.so i have used forloop.
following the code only prints the last function,that means 20th toggle
funtion. i want to call all the toggle function,how do it?
for(var _rr=1;_rr<=20;_rr++){
$("#scell_img"+_rr).toggle(function () {
$("#scell_img1").attr('src','./resources/img/cancercell/cell_'+_rr+'.png');
_US620310CD_1._smallclickcount = _US620310CD_1._smallclickcount + 1;
}, function () {
$("#scell_img"+_rr).attr('src','./resources/img/cancercell/cell'+_rr+'.png');
_US620310CD_1._smallclickcount = _US620310CD_1._smallclickcount - 1;
});
}
No comments:
Post a Comment