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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:15:15+00:00 2026-06-01T23:15:15+00:00

I am creating a input form, and i know how to do onfocus onblur

  • 0

I am creating a input form, and i know how to do onfocus onblur placeholder stuff etc etc..

aside from layering a div on top of my input field, this is what I want to do..

When user clicks in the input field ( in this instance to type in a website address )

How can I make it so that http:// appears in the input field, and when they focus on the field, the text prompt appears after the http://

so all that they do is type in the remainder of the website URL.

example:
enter image description here

   <fieldset>
     <input type="text" class="requiredField" name="websitename" value="http://" onfocus="if(this.value=='http://')this.value='';" onblur=  "if(this.value=='')this.value='http://';"/>
   </fieldset>

From the example above, the http:// appears in the input element. But on click, it disappears. What I wanna do, is the prompt appears AFTER the http:// so thy can type their website address.

Perhaps jQuery could fix this, its hard to know what to search for on google to get some ideas.

I am sure I have seen sites implement this. I dont just want an image, because on submit, I still want it to parse the full URL and not just the http://www.fsfsdfsfsd.com bit that they actually typed in.

Cheers

  • 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-01T23:15:18+00:00Added an answer on June 1, 2026 at 11:15 pm

    Get the value and reinsert the value.

    $('input[name="websitename"]').focus(function() {
        var theVal = $(this).val();
        $(this).val(theVal);
    });
    

    Sorry, EDITED. Forgot the closing parenthesis.

    EDIT 2: Part of the problem you might be seeing is the fact that you have onfocus and onblur on your input, and the onfocus is clearing out the existing value. Remove that and try my script.

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

Sidebar

Related Questions

I'm creating a form with dojo, and I want a range-restricted number input field.
I am in the process of creating an input form on a record specific
I was creating sixth form for a simple one digit user input and it
If I am creating say a input field through MXML , I can set
I am taking the amount from one input box and creating a for...each loop
In some Python (v3) code I am creating lists of Decimals from user input,
I'm creating a web form, where in there are around 12-15 Input Fields... You
So I am trying to get transaction detail from paypal without creating a form
I know for example the Zend Framework has some capability for creating form elements
I have attempted to use $_SESSION in a form input I am creating however

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.