Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

302
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!