Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6375851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:40:08+00:00 2026-05-25T01:40:08+00:00

I have one page with a few forms and I want to add a

  • 0

I have one page with a few forms and I want to add a JQUERY or AJAX check for each input from the form.
All the inputs are required . I did manage to make the check but I need to add check foreach input which I really don’t like.
Can you help me to make this input check little more global.
I have managed to make that code :

$(document).ready(function()
{
    $(document.login.user).blur(function()
    {
        if (document.login.user.value == "")
        {
            document.login.user.style.background = "red";
        }
        else document.login.user.style.background = "white";
    });
    $(document.login.pass).blur(function()
    {
        if (document.login.pass.value == "")
        {
            document.login.pass.style.background = "red";
        }
        else document.login.user.style.background = "white";
    });
});

Can you make it to work global.. to check each input individually and make that effect I have added.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:40:08+00:00Added an answer on May 25, 2026 at 1:40 am

    You can select all the input fields by giving a common class to each of them and use class selector or simple select them by tag name under the form. Try this

    $(document).ready(function(){
        $("form").find("input, textarea").blur(function(){
            var $this = $(this);
            if($this.val() == ""){
                $this.css("backgroundColor", "red");
            }
            else{
                $this.css("backgroundColor", "white");
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will have a web-application which will use a few complex forms. One form
I want to have a few check boxes on my page, and a link
I've got a page with multiple forms that load via ajax. Each form includes
I have few textboxes on one page and one user control. What I want
I have one page website only using HTML, CSS and JavaScript. I want to
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded
i am porting over a website from asp. i have one page that i
I have one master page which applies to all pages in this website. On
I have written a few jquery functions for form validation. It works fine but
So right now, I have a few forms where as one is submitted, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.