I have the following code:
<script type="text/javascript">
$(function() {
//div1 toggle
function runEffect(){
var options = {};
//run the effect
$("#div1_toggle").toggle("blind",options,350);
};
$("#div1").click(function() {
runEffect();
return false;
});
});
</script>
Imagine the above code literally duplicated for a number of divs named div1, div2, div3, etc.
This is horrendously bad, and I would like to rewrite the code such that it applies to a div of any name to toggle a div of (equal name + _toggle).
Bonus: how could I still allow some of these divs to incorporate a different toggle speed (i.e. the 350ms specified above) while reducing redundancy?