Jquery alert function

-1

Good morning!

Does anyone know how to tell me a way to find syntax errors with ease in Jquery?

I have a simple "alert" code that works one way, but not another ...

This works, but bugged:

<script>
$(window).click(function(){
    $('.card.Billet')
    alert("teste");
});
</script>

But the alert is super bugged and everything that loads or clicks the alert.

In the second option, trying to understand how the code structure 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>
    
asked by anonymous 24.09.2018 / 17:00

1 answer

-1

Primeiro de um espaço entre as suas classes css

$('.card .Billet')

depois adicione
e.preventDefault();

vai ficar assim:

$('.card .Billet').click(function(){
    e.preventDefault();
    alert("teste");
});
    
24.09.2018 / 18:56