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>
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?
If you are using JQuery custom selectors like:
$('[class$="yoursuffix"]')
It should return elements whose classes contain your suffix pattern. You can read about it here