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

149
Views
Change element with jQuery when another element is changed

I have a form, and want to change the background color of the submit button whenever all form inputs are filled out. I've started testing this with just 1 input field, but the button color doesn't change in real time as I add content to the input. How can I adjust my code so that as soon as I type anything in the input box, it recognizes it and changes the button color in real time?

jQuery(function($){
   
    var teamname = $('#acff-post-acfef_2207cc4_title').val();
        
    if(teamname !== ''){
        $('.acff-submit-button').css('background-color', 'red');
    }
    
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have to listen to change event on the input field in order to check the value every time it changes. What you are doing right now is checking the value of the field when the page loads.

jQuery(function($){
   
    $('#acff-post-acfef_2207cc4_title').change(() => {
        if ($(this).val() !== '') { // check input value
            $('.acff-submit-button').css('background-color', 'red');
        }
    })
            
});
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!