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 8999713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:12:59+00:00 2026-06-16T00:12:59+00:00

i have form collection and 5 input type = text with different Id and

  • 0

i have form collection and 5 input type = “text” with different Id and 1 submit button like

<form id="frmSubmitSupplier" method="post">
 <input type="text" id="txtCompanyName" name="companyname" />     
<input type="text" id="txtFirstName" name="firstname" />   
 <input type="text" id="txtLastName" name="lastname" />
<input type="text" id="txtAdd1" name="address1" />
 <input type="text" id="txtCity" name="city" />
<input id="btnSupplierSave" type="submit" value="Save"/>
</form>

in jquery code i want to put if condition for all blank textboxes like

$('#frmSubmitSupplier').live('submit', function (e) {
  i want to check here that if all textboxes are empty then any alert but in only single line.. how to check
});
  • 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-06-16T00:13:00+00:00Added an answer on June 16, 2026 at 12:13 am

    You can’t do it in a single line, unless you want it to be unreeadable. You have to iterate over all input’s and check their value.

    CSS:

    .error {
        border: 1px solid red;
    }
    

    JS:

    $('#frmSubmitSupplier').live('submit', function (e) {
        var error = false;
        $(this).find('input[type="text"]').each(function(i, v) {
            if($(v).val() == "") {
                $(v).addClass('error');
                error = true;
            }
        });
        if(error) {
            e.preventDefault();
            //or you can alert('There are unfilled fields!');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HTML: <form method=post id=NewUserRegistration action=inc/q/addNewUser.php> Username: <input type=text name=userName /> <br /> Password: <input
so I have a simple login page like this: <fieldset> <legend>Verification</legend> <form method=post action=authentication.php>
I have a simple html form with two controls: input-text and input-file I need
I created this form: <form method=post action=process-form.php id=emailForm name=emailForm target=_self> <h4>Sign up to be
I have a page with nothing on it but this form: <form method=post action=/sign-in>
I have a ViewModel which contains a collection of type of my Model, like
I have this select input with simple_form: <%= f.input :board, :collection => Board.where(:user_id =>
I have a form where users can modify a collection of objects using a
I have a collection where all form data is stored, each form with a
I have a collection of the form: map<key, list<object> > I only ever insert

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.