Calling Click In Each To Open All Dts
Hello everyone.
I am pretty new to jQuery and i encountered a problem i could not find in other forums, maybe you guys can help me.
I have dts in html and i want to open them all. I have a function called openDt that is pretty simple like this:
- function OpenDt(){
- jQuery(this).next().slideToggle('normal');
And so on.. the use of jQuery(this) is because this is developed for Joomla!.
And i got in the document ready a line like this:
- jQuery('dt').bind("click", OpenDt);
And this part is working fine, the method is been called and the dd (uder the dt) is sliding well.
The problem is when i am trying to apply openAll function to open all the dts in the document by putting the php an if that calls the function if a parameter is true.
The function openAll() is been called, but it seems like nothing happens. As the bind does not work.
Function looks like this:
- function openAll(){
jQuery( 'dt' ).each(function (i) {
jQuery( 'dt' ).click();
});
}
when i try calling the function inside the click the openAll() is not working (still does not open all) and when clicking the dds are getting crazy.
Thank you very much in advnace!
Sorry if it is long, it really bother me..
Bar Saar.