Function to change multiple doms

I’m trying to make a function iterate through all doms with a class and apply diff rules depending on the class. I kinda know what, but don’t know how.

1.On load check input-c for class auc/fix (count input-c and iterate through each?)
2.if auc do this
3.if fix do that
4.end function
5.find next input-c - if none exit
6.repeat step 2-6

html like so

<div class="item-c rowview transition auc">container1</div>
<div class="item-c rowview transition fix">container2</div>
<div class="item-c rowview transition auc">container3</div>
<div class="item-c rowview transition fix">container4</div>

tried along the lines of

$(document).ready(function() {
$.each($(".input-c"), function() {

 if  ($(".item-c").hasClass("fix")){
else if  

doesnt get as far as in!
without .each() … only the first container is checked and that rule is applied to all.
Suppose I need to cycle through all item-c and add count to an array then cycle through the array for each?

Help mucho appreciated

Have you tried “selector”-“function” like in the documentation examples?

$(document).ready(function() {
$(".input-c").each(function(i) {

not getting in =/

$('html').click (function(){
$(".input-c").each(function(i) {

goes as far as click… how can I enter this function?

Item-c and input-c :persevere:


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.