[jQuery] Waiting for a click event...
Hi,
I'm puzzling over something and would be grateful for some help...
I've got four divs on the screen that I have hidden and wish to step through
with each user click. So, the first div is shown... A user then clicks...
The first div is then hidden and the second revealed... A user then
clicks... The second div is then hidden and the third revealed... And so
on...
I thought I could achieve this using the following markup:
<div id="no-1">Content 4</div>
<div id="no-2">Content 4</div>
<div id="no-3">Content 4</div>
<div id="no-4">Content 4</div>
for (var i = 1; i < 5; i++) {
$('#no-'+i).show().click(function() {
$(this).hide(1000);
});
};
}
...but this results in all divs being shown immediately - presumably the
loop is being executed without a click being required?
Is there a simple way around this?
All the best,
--
Ian