-1
Good morning!
Can anyone tell me a way to find syntax errors easily in Jquery?
I have a simple code of "Alert" that works one way, but not another...
That’s how it works, but fucked:
<script>
$(window).click(function(){
$('.card.Billet')
alert("teste");
});
</script>
But Alert gets super buggy and everything that loads or clicks appears the alert.
In the second option, trying to understand how the structure of the code works, I did so, but it did not work:
<script>
$('.card.Billet').click(function(){
alert("teste");
});
</script>
Html:
<label class="card Billet"><input type="radio" value="Billet" class="rdoCreditCards" name="CreditCardProvider" id="CreditCardProvider" displayname="Boleto"><span><small>Boleto</small></span></label>
Gabriel, to give an adequate answer we would have to see the HTML how it is, but, only by js the first code everything that clicks fires the Alert, because you linked the event click in the element
window
that is to click anywhere in the window will fire Alert. Already in the second code does not work pq may not be declared the classes card and Billet in Html.– LeAndrade
I added the HTML in the question bro, actually it is only one element, but as in css I do Xyz.xyz.Xyz I did so, without the space, and yes with the (.)
– Gabriel Salomão
Take the point that works: de:
.card.Billet
to:.card
– João Pedro Schmitz