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

  • Home
  • SEARCH
  • 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 4611086
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:13:14+00:00 2026-05-22T01:13:14+00:00

I have some textboxes which I want to hide and then show on focus

  • 0

I have some textboxes which I want to hide and then show on focus but it doesn’t seem to be working properly

Here’s my jQuery

$("#txt1").live('focus', function() {
    $(this).hide();
    $("#txt2").show().focus();
});

$("#txt2").live('blur', function() {
    if ($(this).attr("value") == "") {
        $(this).hide();
        $("#txt1").show();
    }
});

And here’s my HTML

<input type="text" id="txt1" value="Test" />

<input type="password" style="display:none" id="txt2" />

The problem is that in Internet Explorer the live focus function doesn’t work as expected.

It puts focus on my text box but won’t enable me to type in the box unless I click it again.

I have an example here on jsFiddle

The first Test is the one that is the problem.

I added in the second one which works as expected but I need it to work using the live function.

Any ideas?

  • 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-22T01:13:15+00:00Added an answer on May 22, 2026 at 1:13 am

    I solved the problem by doing this

    function pageLoad() {
    
    $("#txt1").focus(function() {
        $(this).hide();
        $("#txt2").show().focus();
    });
    
    $("#txt2").blur(function() {
        if ($(this).attr("value") == "") {
            $(this).hide();
            $("#txt1").show();
        }
    });
    
    };
    

    Instead of having it in the document.ready()

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

Sidebar

Related Questions

I have grid with some textboxes and an image which goes out of grid
I have some textboxes on a page and I want to click a link
I have a web form with some TextBoxes and CheckBoxList . I want to
I have a client report (rdlc) and want to repeat some textboxes in every
I have a custom user control which has some textboxes and some buttons. In
I have a .Net page with some textboxes, which are sometimes disabled. <asp:TextBox ID=TextBox1
i have some html textBoxes on my webpage, now i want to validate the
I have some PHP code which stores whatever is typed in a textbox in
In my form I have some TextBoxes. Once the value of TextBox is changed
we have a wpf-window with some textboxes and a datagrid. the textboxes descripe a

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.