Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

303
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda