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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:31:43+00:00 2026-06-11T14:31:43+00:00

I have two form elements, a email and a password . The password element

  • 0

I have two form elements, a email and a password. The password element must only be shown if something has been entered in the email element. That is, only if email is not empty.

<input id="email" name="email" onblur="if (jQuery(&quot;#email&quot;).val() === &quot;&quot;) { jQuery(&quot;#password&quot;).hide(); } else { jQuery(&quot;#password&quot;).show(); }" onchange="if (jQuery(&quot;#email&quot;).val() === &quot;&quot;) { jQuery(&quot;#password&quot;).hide(); } else { jQuery(&quot;#password&quot;).show(); }" onfocus="if (jQuery(&quot;#email&quot;).val() === &quot;&quot;) { jQuery(&quot;#password&quot;).hide(); } else { jQuery(&quot;#password&quot;).show(); }" placeholder="Email" style="width:360px;height:28px;margin-bottom:0px;" type="text">

As you see I am handling three events:

  • onfocus: so that I react when the focus enters the email element
  • onblur: so that I react when the focus leaves the email element
  • onchange: so that I react when the email element changes

Actually, I only want to run the script whenever the email changes. I do not care about focus, but I am unable to handle a generic change event.

Besides, and this is my main problem, I am not able to react to the the event generated when the browser is auto-filling the form. Is there such an event? How can I handle it?

  • 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-11T14:31:45+00:00Added an answer on June 11, 2026 at 2:31 pm

    Browser auto-filling occurs on initial page rendering. Have you tried checking the field in an “onReady” callback? Note that this event is only provided by higher level implementations like Jquery, not directly by the browser.

    Example of “ready” callback with jquery: (updated to reflect the comments)

    $(function() {
      setTimeout(function() {
        $("#email").trigger('change');
      }, 200);
    });
    

    There is also an article explaining the “do it yourself way”: http://dustindiaz.com/smallest-domready-ever

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

Sidebar

Related Questions

I have two form elements on my page that act as a smooth login
I have two select elements in my form, Category and Sub-category. At first, only
I have two elements on my form - textarea and file element for file
I have application in VB.net that have two different form (Form1 and Form2). Now
I have two fields on the form ( forgotpassword form ) username and email
I have two elements one in top of the other: <form class=order-form></form> <a href=#
On a form, I have two combobox wich have the same DataSource (their elements
I have a total of 3 pages; form elements are distributed among two pages,
I have two <button> elements in one form. First <button> have a click handler,
I have two input elements. One is to put your email and the other

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.