2
I’m creating some If
's not to lose the habit of using them, but when trying something a little different from what I usually do, an error occurs, the if
does not work. How can I fix ? I tried in the following ways:
if($('.carousel-indicators li.active').data('slide-to').val() = 0){
console.log('Teste');
};
ERRO : Uncaught ReferenceError: Invalid left-hand side in assignment
and
if($('.carousel-indicators li.active').data('slide-to') = 0){
console.log('Teste');
};
ERRO : Uncaught TypeError: $(...).data(...).val is not a function
A sign of equals was missing
.val() == 0
and why are you using.data().val()
??– Thiago Santos
Because simply the . data() had not worked
– Murilo Melo