I am trying to modify a div that has a given class with the following jquery code:
$("[class^=delay-][class$='+number+']").each(function(index) {
var delayTime = $(this).attr('class').match(/delay-(\d+)/)[1];
$(this).removeClass("[class^=delay-][class$='+number+']");
$(this).data('data-wow-delay', delayTime + 's');
});
- Find the divs that has delay-1, or delay-3, and so on...
- Get the number as a variable.
- Remove the class because I don't need it anymore.
- Add to the div data-wow-delay="1s"
I am using the above script but it doesn't seem to succeed in identifying the class.