toarelli Posted June 3, 2018 at 07:26 PM Report #610848 Posted June 3, 2018 at 07:26 PM Caros amigos. Desculpa incomodar os amigos com uma dúvida minha. Como faço para quando o usuário clicar em um button desabilita o outro, por exemplo: button ALTERAR ativo button SALVAR desativado. Quando clicar no ALTERAR o button muda para SALVAR. o código abaixo, usa um checkbox, ativa e desativa um input='text', alem disso, preciso que muda o button. <script> var checkobj function agreesubmit(el){ checkobj=el if (document.all||document.getElementById){ for (i=0;i<checkobj.form.length;i++){ var tempobj=checkobj.form.elements[i] if(tempobj.type.toLowerCase()=="text"||tempobj.type.toLowerCase()=="button") tempobj.disabled=!checkobj.checked } } } </script> <form name="form_hab" action="" enctype="multipart/form-data" method="POST" > <div class="col-sm-2 invoice-col"> <input type="text" id="item<?=$codProdClie?>" name="qtdeCota" value="<?php echo $cotaQtde; ?>" disabled style="width:70%; text-align:right; font-size:15px;" > <input type="hidden" name="cotaItensId" value="<?php echo $cotaItensId; ?>"> <input type="hidden" name="cotaNumero" value="<?php echo $cotaNumero;?>" /> <button type="button" name="altCota" id="altCota" class="btn btn-success" value="Alterar" disabled > <i class="fa fa-close" style="font-size:16px;"></i> </button> </div> <div class="col-sm-1 invoice-col"> <input name="agreecheck" type="checkbox" onClick="agreesubmit(this,'item<?=$codProdClie?>');">Ativar </div> </form> Grato, Toarelli
HappyHippyHippo Posted June 4, 2018 at 02:39 PM Report #610852 Posted June 4, 2018 at 02:39 PM não percebo a tua pergunta, falas em dois butões mas o código só apresenta um .... no entanto, no final, isto é trabalho de javascript e não do PHP IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now