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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:10:09+00:00 2026-06-08T13:10:09+00:00

I am using placeholders for input boxes in my application and a jquery workaround

  • 0

I am using placeholders for input boxes in my application and a jquery workaround for browsers that do not support placeholders. However in most browsers the placeholder disappears when the input is in focus even though it is empty. One workaround is to use a transparent bg on the input field and put a span with the text directly behind the input field and change the bg to opaque once something has been typed in. The problem is that my application now has over 3000 input fields. Is this possible to do this via a jquery plugin in run time? or I am open to a better suggestion. Please help.

  • 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-08T13:10:10+00:00Added an answer on June 8, 2026 at 1:10 pm

    This is what i wrote and am using:

        <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <style>
    body{
        background-color:#DDD;
    }
    
    span.placeholder
    {
        background-color:#FFF;
        color:#777;
        border-radius: 4px 4px 4px 4px;
        margin: 5px 0;
        padding: 9px 0 8px 13px;
        width: 297px;
    
    }
    input
    {
        border: 1px solid #707A68;
        border-radius: 4px 4px 4px 4px;
        margin: 5px 0;
        padding: 10px;
        width: 310px;
        background:transparent;
    }
    
    </style>
    
    <body>
    <div>
        <input type="text" placeholder="hello" name="hh"/>
    </div>
    </body>
    
    <script>
    $('input').each(function(){
    
        var txt = $(this).attr('placeholder');
        var name = $(this).attr('name');
        var node = $("<span class='placeholder'>"+txt+"</span>").appendTo($(this).parent());
        $(this).before(node);
        node.css('position','absolute');
        node.css('z-index','-1');
        node.css('display','block');
        $(this).attr('placeholder','');
    });
    $('input').bind('keyup',function(){
        if($(this).val()=="")
            $(this).css('background','transparent');
        else
            $(this).css('background','#FFF');
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I'm using a placeholder jQuery plugin that reads the placeholder attribute from input
There's placeholder on the page that is loaded asynchronously using jQuery load method. Page
I'm using a placeholder span in my input fields. Using jQuery, I show/hide the
I am using the following code, to prepopulate entries for browsers that do not
using the below jquery placeholder plugin that creates labels and overlays the field with
I've been using a JavaScript placeholder script, to support IE placeholders. Works fine for
I have a form that has placeholders for input fields. It uses html5 placeholder
I am using jQuery to add placeholders to each text box on a page.
I am using this script : http://www.morethannothing.co.uk/wp-content/uploads/2010/01/placeholder.js to get some placeholders into IE. Works
I am using the jQuery mask plugin from http://digitalbush.com/projects/masked-input-plugin/ I want to customize my

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.