Jump to content

Recommended Posts

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.