I am trying to get a jQuery conditional to apply a class to this particular element – – when another element contains a particular ID. Here's what I have so far:
<script type="text/javascript">
$(document).ready(function() {
if( $('.container-fluid').hasId('europe') === true )
{
$('controlBar_playerVideo1').addClass('darkcontrols');
}
});
</script>
Here's the live site: http://fsa.space/
When I add the script above to the footer I get an "undefined is not a function" error in the console. I should mention I am a total jQuery novice (which should be abundantly apparent).
I would be grateful if someone could provide pointers to achieve this.
try this
<script type="text/javascript">
$(document).ready(function() {
if ($('.container-fluid').attr("id") == "europe") {
$('controlBar_playerVideo1').addClass('darkcontrols');
}
});
</script>
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