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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:04:05+00:00 2026-05-23T17:04:05+00:00

I really can’t explain this one properly, so here’s a screenshot: How do I

  • 0

I really can’t explain this one properly, so here’s a screenshot:
enter image description here

How do I capture the event when this red highlight appears around an email field on firefox. So that I could perform something. The code below is a just a pseudo code mixed with some formal code:

 <script src="jq.js"></script>
    <script>
    $(function(){

        $('#btn_yo').click(function(){
            $('input').each(function(index){
                if($(this:required == 'true'){
                    //do something
                }
            });
        });
    });
    </script>
    <input type="text" name="name" id="name"  required/>
    <input type="email" name="mail" id="mail"/>
    <input type="button" id="btn_yo" value="submit"/>

the email attribute only accepts email attributes, and when you input something else, its automatically highlighted with red border. How do I go about capturing that event so that I could do a custom action instead of the red-highlight which is the default.

  • 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-23T17:04:06+00:00Added an answer on May 23, 2026 at 5:04 pm

    I think probably what you want to use is blur, such that when the user leaves a given input field, you can perform validation of that field and flag it as invalid if needed. For instance:

    $("input").blur(function(evt) {
        if (this.required && this.value == "") {
            alert(this.name + " is a required field!");
            $(this).addClass("error");
            this.focus();
        }
        else {
            $(this).removeClass("error");
        }
    });
    

    Which gives you something like this: http://jsfiddle.net/CJ5Zc/1/

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

Sidebar

Related Questions

I really can't wrap my mind around this: Previously I couldn't get Framebuffers to
I've got a really simple rails question here but I can't seem to find
I really can't work out how to best do this, I can do fairly
I really can't believe I couldn't find a clear answer to this... How do
I really can't find the error. Here is my code: <? // Action: add
Can anyone help with this I really can't see what is wrong. I have
Java is supposed to be write once, run anywhere and it really can be,
Can I really and truly trust .NET to initialize fields (like ints, structs and
I've done some research and I can't really find a preferred way to do
Distributing ASP.NET user controls across different projects can be really useful when you want

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.