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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:22:51+00:00 2026-06-02T22:22:51+00:00

I have an input box which tests whether the email in the box is

  • 0

I have an input box which tests whether the email in the box is a valid one. This is the script:

$("#myform").validate({
  rules: {
    field: {
      required: true,
      email: true
    }
  }
});

This tests for the email. I also have this script which would change the color by adding another class to the form.

$("#myform").toggleClass("othercolor");

Im just not sure where to put this code. Sorry for the newby question just new to jQuery. Thanks =D

  • 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-02T22:22:52+00:00Added an answer on June 2, 2026 at 10:22 pm

    Here’s a demo… (UPDATED)

    It looks like you might be using the jQuery validation plugin. Assuming that you are, you just need to initialise the form validation by executing $("#myform").validate() when the page loads (e.g. by putting it calling it from $(document).ready()).

    $(document).ready(function(){
      $("#myform").validate();
    });
    

    ​
    If you want to apply a CSS class when the focus leaves the email field, you could do something like this:

    var validator = null;
    $(document).ready(function(){
        validator = $("#myform").validate({
          rules: {
            cemail: {
              required: true,
              email: true
            }
          }
        });
    
    
        $("#cemail").blur(function() {
            if (validator.form()) {
                $("#myform").addClass("othercolor");
            }
            else {
                $("#myform").removeClass("othercolor");
            }
         });
    });​
    

    ​
    validator.form() returns true if the form is valid, and false if it isn’t. Note that .toggleclass() won’t do what you want here; you’ll need to add or remove the class based on the return value of validator.form().

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

Sidebar

Related Questions

i have one form which have some input box and some select box. i
I have an input box which I want to handle two types of information,
I have an input box for which I am using the Jquery autocomplete function.
I have an input box which i use to add items to a table
I have an text input box which needs to be used as a search.
I have a an input box on my homepage which i want users to
I have a form with a text input box which displays similar entries to
I have an input box which is present inside a Div tag. My issue
I have a input box which looks like below, <input id=basic-search type=text value=Enter keyword
I have progress.js file which has the following code $('#text_area_input').keyup(function() { var text_area_box =$(this).val();//Get

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.