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

The Archive Base Latest Questions

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

All I want to do is create an input with an initialised value. Then

  • 0

All I want to do is create an input with an initialised value. Then when focused it clears the text field. however on blur and when the field is empty it should return its initialised value. It should also work with password fields. This is what i came up with its not working in ie.

Error message
enter image description here

      $$('.default-text').each(function(item){

        item.store('default-value', item.get('value'));

       if(item.get('type') == 'password') {
            item.store('default-type', 'password');
            item.set('type', 'text');
            item.addEvent('keyup',function(el){
                if(item.get('value') != item.retrieve('default-value')) {
                    item.set('type', 'password');
                }
            });
        }            
        item.addEvent('focus',function(el){
            if(item.get('value') == item.retrieve('default-value')) {
                item.set('value','');
            }
        });
        item.addEvent('blur',function(){
            if(item.get('value') == '') {
                item.set('value', item.retrieve('default-value'));
                if(item.retrieve('default-type') == 'password') {
                    item.set('type', 'text' );
                }
            }
        });
    });
  • 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:44:09+00:00Added an answer on May 23, 2026 at 5:44 pm

    IE has a problem with swapping input.type properties.

    Swapping between types just does not appear work, if I remember correctly – which I think they did to save themselves some grief.

    Eg, change a text field to a file field has security implications, field.set("value", "c:\autoexec.bat").set("type", "file").getParent().send().

    change password to text, also dodgy (would reveal password in plain text). change text to checkbox/radio has reflow and behaviour issues.

    I can continue but IE team just thought it best to not allow these and put an end to them, rather than deal with each case.

    You need to rethink your logic somewhat.

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

Sidebar

Related Questions

Hi , I want to create a simple function to reset all input values
I want to create a input textbox that does not require a <input type=text>
I want to create a string in JavaScript that contains all ascii characters. How
I want to create a c# application with multiple windows that are all transparent
I want to create UI elements programmatically without using xib files. All of the
Lets say you want to create a listing of widgets The Widget Manufacturers all
Hallo all. i want to create a .htaccess file if i type subdomain.domain.com can
I learning Perl and I want to create a simple application that gets all
Ok, so I want to create a database with all the data of the
I have been tinkering with javasript (jquery) all day. I want to create 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.