Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

306
Visualizações
Show/hide buttons if input don't have @

I have a form, and I need to hide the buttons if in the email input there is no "@" and if the phone input doesn't have at least 8 numbers. I have success with the second but trouble with the first condition

$('.vti__input').keyup(function() { 
if ($(this).val().length <= 8) {
 $('.widget-channels').hide(); 
 }
 else {
  $('.widget-channels').show(); }
   }).keyup(); 
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
   
   
   <input type="text" name="email" placeholder="Ваша почта*" class="input-text"></div>
    
    <input type="tel" placeholder="Ваш телефон*" autocomplete="off" name="phone" id="" maxlength="25" tabindex="0" class="vti__input">
    
    <div class="widget-channels"><button class="telegram-channel">
    <span class="channel-icon">
    <img src="/img/icons/svg/telegram.svg" alt="Telegram"></span> 
    <div>Telegram</div>
    </button>
    <button class="viber-channel"><span class="channel-icon">
    <img src="/img/icons/svg/viber.svg" alt="Viber"></span> 
    <div>Viber</div>
    </button>
    </div>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use javascript's include function

let phone = $('.vti__input')
let email = $('.input-text')
let widget = $('.widget-channels')

phone.keyup(function() {
  if (phone.val().length <= 8 || !email.val().includes("@") ) {
    widget.hide();
  } else {
    widget.show();
  }
}).keyup();

email.keyup(function() {
  if (phone.val().length <= 8 || !email.val().includes("@") ) {
    widget.hide();
  } else {
    widget.show();
  }
}).keyup();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>


<input type="text" name="email" placeholder="Ваша почта*" class="input-text"></div>

<input type="tel" placeholder="Ваш телефон*" autocomplete="off" name="phone" id="" maxlength="25" tabindex="0" class="vti__input">

<div class="widget-channels"><button class="telegram-channel">
    <span class="channel-icon">
    <img src="/img/icons/svg/telegram.svg" alt="Telegram"></span> 
    <div>Telegram</div>
    </button>
  <button class="viber-channel"><span class="channel-icon">
    <img src="/img/icons/svg/viber.svg" alt="Viber"></span> 
    <div>Viber</div>
    </button>
</div>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda