Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery loop through elements with class suffix

I have a class suffix named fadecontent in a joomla 3.0 website, and i have to loop trough all div's that have this class suffix using the $.each() function.

I tried this but it seems not to work with class suffixes. joomla docs: class suffix

$('.fadecontent').each(function(i, obj) {

with class suffix i mean this:

<div class="class classSuffix">exemple</div>
<!--example in my code-->
<div class="moduletable fadecontent">content</div>

How to archieve this?

EDIT: the script is in the <HEAD> tag

like image 538
JoJo Avatar asked Sep 16 '25 06:09

JoJo


1 Answers

I'm not sure I understand what you mean by class suffixes. in your example

<div class="moduletable fadecontent">content</div>

That div has both the class moduletable and fadecontent. So this should loop through all the divs with the 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 might be able to see any other errors?

like image 56
willcwf Avatar answered Sep 17 '25 19:09

willcwf