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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:29:54+00:00 2026-05-18T02:29:54+00:00

I am currently using: <input type=text value=username onfocus=this.value=” name=login id=login> on my sign in

  • 0

I am currently using:

<input type="text" value="username" onfocus="this.value=''" name="login" id="login">

on my sign in form field on my site, which populates the form with the word “username” until the user clicks on the field, which is then cleared.

The problem is, if the user clicks on the field, types something in, clicks away, and clicks back, it clears whatever they have typed!

I am already using prototype on my site so I was wondering if there was a way, using prototype, I could just have the very first “onfocus” clear the field, but never again after that.

Does this make sense? I am having trouble googling any resources, can someone point me in the right direction?

I tried:

<input type="text" value="username" onfocus="if (this.value = 'username') this.value = ''" name="login" id="login">

and it doesn’t seem to be working

  • 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-18T02:29:55+00:00Added an answer on May 18, 2026 at 2:29 am

    Only conditionally clear it:

    if (this.value == 'username') this.value = ''

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

Sidebar

Related Questions

currently I have following code: home.php <form name='myformname' id='myformid'> <input type='text' name='mytext1' value='abc'> <input
I'm currently using inline javascript to clear an input text's default value on focus.
I'm currently using jQuery to restrict a text box to number only input as
I am currently using Ajax to submit an input field without a page refresh
I am currently using a catch all method for all inputs on my form
Currently using MySQL version 5.1.6 This is my first real world build and so
I have the following type of input text file 28306.5934893134 Const for C 0.086628745225
I've been read this article : commandButton/commandLink/ajax action/listener method not invoked or input value
Is this possible to achieve without javascript/jQuery? I currently have a login template with
I'm using Gravity Forms product fields to create an order form type system. I'm

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.