-3
I want when the person clicks on button 1, automatically the radio 2 is selected, thus preventing the user from making two clicks.
How can I do that?
Note: The same thing will also happen when selecting another payment method.
I tried using this example of the guy above, but checked is giving null!!!
Where am I going wrong?
<script type="text/javascript">// true = selecionar ~ false = deselecionar
function um(){
document.getElementById('payment_method_iugu-credit-card').checked = true;
document.getElementById('payment_method_iugu-bank-slip').checked = false;
document.getElementById('payment_method_wc_ticket_installments').checked = false;
document.getElementById('payment_method_pagseguro').checked = false;
}
function dois(){
document.getElementById('payment_method_iugu-credit-card').checked = false;
document.getElementById('payment_method_iugu-bank-slip').checked = true;
document.getElementById('payment_method_wc_ticket_installments').checked = false;
document.getElementById('payment_method_pagseguro').checked = false;
}
function tres(){
document.getElementById('payment_method_iugu-credit-card').checked = false;
document.getElementById('payment_method_iugu-bank-slip').checked = false;
document.getElementById('payment_method_wc_ticket_installments').checked = true;
document.getElementById('payment_method_pagseguro').checked = false;
}
function quatro(){
document.getElementById('payment_method_iugu-credit-card').checked = false;
document.getElementById('payment_method_iugu-bank-slip').checked = false;
document.getElementById('payment_method_wc_ticket_installments').checked = false;
document.getElementById('payment_method_pagseguro').checked = true;
}</script>
<div class="textopagamento"><h3>Pagamento</h3></div>
<ul class="abapagamento nav nav-tabs">
<li ><a id="bot-um" onclick="um()" href="#divhideiugu-credit-card">Cartão S/ Juros</a></li>
<li ><a id="bot-dois" onclick="dois()" href="#divhideiugu-bank-slip">Boleto à Vista </a></li>
<li ><a id="bot-tres" onclick="tres()" href="#divhidewc_ticket_installments">Boleto Parcelado </a></li>
<li ><a id="bot-quatro" onclick="quatro()" href="#divhidepagseguro">Pag Seguro</a></li>
</ul>
</div>
It would be important to put in the question the HTML of the buttons and radios so that we can know the structure and link a button to each radio.
– Sam
I posted the page link because the HTML code is too long.
– Matheus Rodrigues
@Matheusrodrigues If the original code is too long, vc can reduce it to a [mcve] <== click on this link, there are great tips to reduce the code to an equivalent that reproduces the same behavior and/or problem of its original code. This is important because all relevant information should be in the question. Links should be for add-on only. If the link is out of the air, for example, still the question will continue with all information. See more about this here.
– hkotsubo