when using this function for example
function add_custom_div(){
?>
<script>
jQuery(“.bt-01”).click(function(){
window.location = jQuery(this).find(“a:first”).attr(“href”);
return false;
});
</script>
<?php
}
add_action(‘wp_footer’, ‘add_custom_div’);
?>
>>>is it possible to add more classes separated with a comma within the same function code? Rather than repeating the function code for every class I need to effect.
So for example,
function add_custom_div(){
?>
<script>
jQuery(“.bt-01, .bt-02, .bt.03, .bt-04”).click(function(){
window.location = jQuery(this).find(“a:first”).attr(“href”);
return false;
});
</script>
<?php
}
add_action(‘wp_footer’, ‘add_custom_div’);
?>
Hey user877!
That’s not a theme question but yes you can add commas like that. You can learn more about jQuery here, https://api.jquery.com/category/selectors/.
Cheers!
Elliott
thanks appreciate it.