click on span and mark checkbox

Asked

Viewed 146 times

3

I’m trying to make sure that when clicking on the span, the checkbox is marked, but it seems to be in error.

Help me please.

<input type="checkbox" id="remember_pass"> <span for="remember_pass"> Lembrar senha</span>

I had already done it once, but this time it’s not working.

Thank you.

1 answer

2


The mistake is that you used one span and should be a label the attribute for="" only works in the <label>

<input type="checkbox" id="remember_pass"> <label for="remember_pass"> Lembrar senha</label>

  • Thank you very much, simple mistake...

  • 1

    @Samuelmachado are so many tags that sometimes we even get confused rss. For more information about the label here is a link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#Attributes

  • Thanks, it really confuses kkk

  • @Samuelmachado without problems

  • @Samuelmachado then remember to mark the answer as you watch this icon next to the arrow keys in the answer if you think you have solved the problem. So the question is not open pending on the site answered , but does not accept

Browser other questions tagged

You are not signed in. Login or sign up in order to post.