I've never used Mootools, so I can only guess, but it looks like you
have an html structure like this:
<div class="Boite">
<a href="#">some link</a>
<div>this will be toggled</div>
</div>
<div class="Boite">
<a href="#">some link</a>
<div>this will be toggled</div>
</div>
If that's the case, this would probably work:
$(document).ready(function() {
$('.Boite')
.find('div').hide()
.end()
.find('> a').click(function() {
$(this).parent().find('div').toggle();
return false;
});
});
Or at least it'll get you on the right track.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Sep 5, 2008, at 1:13 PM, israel.hayes wrote:
Hi,
I was using MooTools before and I'm kinda new to jQuery, I'd like to
know how you would modify this to use it in jQuery, Thanks,
- Israel
window.addEvent('domready', function()
{
var Boites = $$('.Boite');
Boites.each(function(Boite)
{
var Lien = Boite.getElement('a');
Lien.addEvent('click', function()
{
var Boite = Lien.getParent();
var Contenu = Boite.getElement('div');
if(Contenu.style.display == "none")
{
Contenu.style.display = "block";
}
else
{
Contenu.style.display = "none";
}
});
var Contenu = Boite.getElement('div');
Contenu.style.display = 'none';
});
});