Where to add Javascript to add a class?
-
Hi,
I am wanting to add a css class to some of the store listings depending on if the user is logged in or not. I am using a javascript function to achieve this:if ( is_user_logged_in() ) { ?> <script type="text/javascript"> function addPetrolClass() { var element = document.getElementById("wpsl-stores"); element.classList.add("petrol-choice"); } </script> <?php }
I was attempting to do this using the wpsl_store_data filter but its not working – could you advise what filter / hook would be a good place to do this?
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Where to add Javascript to add a class?’ is closed to new replies.