Hello,
I want to hide and show some form in my page.
For each form theres a link, and i want that, when i click on this link, it hide and show the nearest form of the link.
My code looks like this :
$$('.flagLink').each(function(s){
$(s).observe('click', function(event) {
// here i want to hide and show the nearest form
});
});
I've tried this :
$$('.flagLink').each(function(s){
$(s).observe('click', function(event) {
$(s).next('form').toggle();
});
});
It works but, i would like to be more precise like :
$$('.flagLink').each(function(s){
$(s).observe('click', function(event) {
$(s).next('.flagForm').toggle();
});
});
but the .flagForm selector doesnt work.
My code looks like this : flag
First I hide all the form in the page : $$('.flagForm').each(function(s){ $(s).hide(); }); Then i add the onclick event on them : $$('.flagLink').each(function(s){ $(s).observe('click', function(event) { $(s).next('.flagForm').toggle(); }); });
But with the .flagForm selector, it does not work