How to use jquery to change class in wordpress -


i'm trying have accordion slider (enfold theme) open specific slide (unfortunately enfold not provide that). i've tried can think of starting code:

<script> $( window ).load(function(){ $('.aviaccordion-inner').find('.aviaccordian-slide-     3').addclass('aviaccordian-active-slide');  }); </script> 

then tried code:

<script> jquery(document).ready(function( $ ) {  $( window ).load(function(){ $('.aviaccordion-inner').find('.aviaccordian-slide-    3').addclass('aviaccordian-active-slide'); });  }); </script> 

i used "(window).load" etc. because had no luck either simple "(document).ready". made sure loading after slider , jquery load. tried putting in body before slider loads. have ideas on how can load particular slide on 'load'?

the url website is: http://www.twinsupplies.net/2017/

this correct syntax target element class , add class in jquery. please give try , let me know happens, change '.classyouwanttotarget' class you're trying target , 'classyouwanttoadd' class name you're trying add.

<script>     $(function(){         $('.classyouwanttotarget').addclass('classyouwanttoadd');     }); </script> 

another tactic i've used on dynamically appearing elements this...

<script> $(function() {     //name interval target later     var myinterval = setinterval(function() {         //code first example         $('.classyouwanttotarget').addclass('classyouwanttoadd');         //see if class has class you're trying add         if($('.classyouwanttotarget').hasclass('classyouwanttoadd')) {             //if so, clear interval             clearinterval(myinterval);         }    //minimum acceptable interval time of today    }, 4); }); </script> 

edit:

you must have jquery added site or "not function" error in console. add script right before end of body tag.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -