Is there any way to position the required message?

Asked

Viewed 187 times

0

I have the following html

<ul class="pagamento-metodos">
   <li class="pagamento-metodo paypal">
     <input name="payment_methods" type="radio" id="paypal" value="paypal" required>
     <label for="paypal"></label>
   </li>
   <li class="pagamento-metodo pagseguro">
     <input name="payment_methods" type="radio" id="pagseguro" value="pagseguro">
     <label for="pagseguro"></label>
   </li>
   <li class="pagamento-metodo boleto">
     <input name="payment_methods" type="radio" id="boleto" value="boleto">
     <label for="boleto"></label>
   </li>
</ul>

In the CSS did so:

input[type=radio] {
    left:-100px;
    position:absolute;
}

With that, I can "hide" the Radio Buttons and stylize with more CSS of course, the Labels to take the place of radio buds and I can still fully function required.

The problem is, how I positioned the radio Buttons off the screen and therefore your message will also stay and will not be seen.

It is possible to change only the positioning of the require over the label and maintain its own radio button hidden?

  • If I understand correctly you want to hide only the training wheels of the right radios?

1 answer

1


All it will take is one opacity: 0; in the inputs and change the position of the Abels to go to their place, they continued there but did not occupy space, and even with the label you will be able to select it because it is present. Look at this jsfiddle - https://jsfiddle.net/goqkkfz8/1/

  • That’s not it. The detail is to make the require message appear in the correct position even with the radio input shifted from position. Doing disoplay:None, the validation goes straight to the next field or submits the form, I’m able to select normally, the problem is the field validation without filling. I wouldn’t like to use JS. Only the Html5 require itself.

  • Already understood, you want that when it gives the required error, it appears in the label and not in the right input?

  • Actually I want the warning to appear. It can even be in the same input. The problem is that the input is positioned outside the screen, which takes the error message also out being not possible its visualization. In that case, I wanted to bring only the input error message to the screen but keep it off the screen. I don’t know if that’s possible!

  • @Carlosrocha Tentou opacity:0?

  • @Carlosrocha Look at my fiddle js, I updated

  • exact: opacity:0. Thank you very much! Only opacity:0 has solved. http://www.hotplateprensas.com.br/styles/

Show 1 more comment

Browser other questions tagged

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