Firstly, I am new to jQuery, coming from a Java background, so apologies if this question seems a bit weird.
Basically, I have two sepereate unrelated elements on a page, and based on the selector results from one, I need to change the styling on a second element.
I need to check for:
$("#slide1.current")
Once found, I need to execute the following:
$('.asset.assetStyleNone.assetCount1').removeClass('assetStyleNone').addClass('currentSlide');
I guess what I ideally need to do is something along the lines of:
$("#slide1.current").XXX(function() {
$('.asset.assetStyleNone.assetCount1').removeClass('assetStyleNone').addClass('currentSlide');
});
But my problem is knowing what the ‘XXX’ should be. I do know that it cannot be a ‘click’ event, as there are no interactive clicks that change the state of elemenst on this page.
Is this kind of thing possible in jQuery?
Thanks in advance for your help.
If you want to check if
#slide1.currentexists, use this:Note, this check only takes place once, I’m not sure you want a callback on the event your selected element is created.