Hello Mike, thanks for replying. I have to my code for this problem, this will make things come put clearer.
repSelectorH2 = new Array("divname1", "divnamearbitrary", "divtwo"); function shortenToggle(jSelector,Selector,showId){ if (Selector.length != showId.length) { alert('numer not equal\n' + Selector.length + "\n" + showId.length); } else { for (var i=0; i<Selector.length; i++) { eval('\$("' + jSelector + '(\'' + Selector[i] + '\')").click(function () { \$("' + showId[i] + '").toggle("fast"); });') }}} $(document).ready(function(){ shortenToggle('h2:contains',repSelectorH2,repShowIdH2); }); Here you can see in detail how im using eval. In this case i dont think that i can use each, because my selectors have to grab different div's i look forward to see your approaches kind regards