JQuery loop through elements with class suffix
I have a class suffix with a name fadecontent
on a joomla 3.0 website and I need to go through all divs that have that class suffix using the $ .each () function.
I tried this one but it doesn't seem to work with suffixes . joomla docs: class suffix
$('.fadecontent').each(function(i, obj) {
with the class suffix i means the following:
<div class="class classSuffix">exemple</div>
<!--example in my code-->
<div class="moduletable fadecontent">content</div>
How to do it?
EDIT: the script is in the tag<HEAD>
+3
source to share
2 answers
I'm not sure I understand what you mean by class suffixes. in your example
<div class="moduletable fadecontent">content</div>
This div has both a moduletable and a fadecontent class. So this should go through all divs with class fadecontent
$('.fadecontent').each(function() { console.log('Do Something here'); });
If this doesn't achieve what you're looking for, can you post more of your code so we can see any other errors?
+3
source to share