$(document).ready(function(){ if($('.listelement .element').find('.dispnone').length >= 1){ console.log($(this)); $('.listelement .element').find('.dispnone').parent().find('.title') .css('cursor','pointer') .prepend(" ") .data('toggle','0'); $('.listelement .title').click(function(){ $(this).siblings('.dispnone').toggle(); if($(this).data('toggle') == '0'){ $(this).data('toggle','1'); $(this).find('.toggler img').attr('src','/media/img/down.png') } else{ $(this).data('toggle','0'); $(this).find('.toggler img').attr('src','/media/img/right.png') } }); } }); function checkAllCheckBoxes(exceptions) { $('input:checkbox').attr('checked','checked'); return; } function uncheckAllCheckBoxes(exceptions) { $('input:checkbox').attr('checked',''); return; }