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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:53:40+00:00 2026-06-03T16:53:40+00:00

html code <div id="signup"> <form id="suform" method="POST" action="roma/roma"> <p> <label>Frist Name</label> <input type="text" id="sufName"/>

  • 0

html code

<div id="signup">
    <form  id="suform" method="POST" action="roma/roma">
        <p>
            <label>Frist Name</label>
            <input type="text" id="sufName"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Last Name</label>
            <input type="text" id="sulName"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Email</label>
            <input type="text" id="suEmail"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Mobile Number</label>
            <input type="text" id="suMNumber"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Password</label>
            <input type="password" id="suPassword"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Re Password</label>
            <input type="password" id="suRePassword"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <input type="submit" class="button" value="sign up"/>
        </p>
    </form>
</div>

it is just six input fields to make a sign up page
and this is the jQuery code to ensure that there is no input field empty, and if there is no input field empty I want to submit the form.

jQuery code

$(document).ready(function(){
    $('#suform').on('submit', function(e){
        e.preventDefault();
        var errorCount = 0;
        $('span.errorMessage').text(''); // reset all error mesaage
        $('input').each(function(){
            var $this = $(this);
            if($this.val() === ''){
                var error = 'Please fill ' + $this.prev('label').text(); // take the input field from label
                $this.next('span').text(error);
                errorCount = errorCount + 1;   
            }
        });
        if(errorCount === 0){
            $(this).submit(); // submit form if no error
        }
    });
});

The code ensure that there is no input field empty, it found an empty one then an error message will appear, else should submit, but the submit doesn’t work.

code

  • 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-03T16:53:42+00:00Added an answer on June 3, 2026 at 4:53 pm

    Try using $(this)[0].submit();. Using $(this) refers to the jQuery object reference to the form. I don’t know what jQuery’s submit() method actually does, but it clearly doesn’t submit the form. Using $(this)[0] refers to the actual DOM element, which will use the standard DOM submit method, which is what you’re looking for.

    I’m sure you know this already, but you should use server and client side validation, because some users don’t have JS and some users will purposely tamper with your form. Just a quick “Don’t forget”!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

html code <div id="signup"> <p> <label>Frist Name</label> <input type="text"/> <p> <p> <label>Last Name</label> <input
I have this html code: <div class=action> some_text <a class=delete_action name=q1>some</a> </div> <div class=action>
This is my code : HTML <input type="textbox" id="txtComune" /> <div id="myOwnMenuComuni" style="position:absolute; top:0;
I have an Html code as such <li> <ul> <li id="6"><input type="radio" name="sell" value="sell"
I have nav code like this in my HTML file: <div id="center_links"> <ul> <li><a
This is my html code : <div id=d1 class=division> <input type=button value=one class=division> </div>
Let's say I have the following HTML code <div id="outer"> <div id="inner">Hello World</div> </div>
I have this code : HTML <div class="draggable_main_container"> <div class="draggable_container"> <div class="draggable"> <div class="minus">
I have this code : HTML <a href="javascript:void(0);" id="showDiv">Show Agency</a> <div id="invisibleDiv"> <script src="http://platform.linkedin.com/in.js"
This is my code : HTML <div style="display:none;"> <div id="example"> <div class="child">Hello</div> </div> </div>

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.