I have a problem with the following JavaScript code:
$( "#toggleLog-1" ).click(function() {
$( "#toggled-1" ).slideToggle( "slow" );
});
$( "#toggleLog-2" ).click(function() {
$( "#toggled-2" ).slideToggle( "slow" );
});
$( "#toggleLog-3" ).click(function() {
$( "#toggled-3" ).slideToggle( "slow" );
});
/// ... and many other IDs
As you can see, I want to know how to increment the id and compact my code, because I have many IDs in my css file. In php I know how I would do this (with a foreach and increment function), but how can I do it in JavaScript?