I'm a complete jQuery noob. I'm grabbing button_types and and div variables but this is giving me the error:
<script>
$(function(){
$('div [button_type="'type'"]').addClass('active');
$('div [image-var="'image'"]').addClass('active');
});
</script>
I've tried putting the ) in a multitude of locations but I'm guessing there's a bigger issue with my syntax that's causing this.
Probably an easy solution for someone that knows jQuery.
You're missing the + signs with your variables:
$('div [button_type="' + type + '"]').addClass('active');
$('div [image-var="' + image + '"]').addClass('active');
You're missing + when concatenating. Should be
$(function(){
$('div [button_type="' + type + '"]').addClass('active');
$('div [image-var="' + image +'"]').addClass('active');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With