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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:38:28+00:00 2026-05-20T10:38:28+00:00

I am trying to setup a script that will feature a Placeholder backup for

  • 0

I am trying to setup a script that will feature a “Placeholder” backup for non-html5 browsers. I have everything working on regular site content. What is not working, is when I load content in via ajax.

I need to figure out how to add the .live() function to the script so it will work on ajax loaded content. Anyone have any advice? I can’t seem to figure it out.

jQuery.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) jQuery.support.placeholder = true;

if (!jQuery.support.placeholder) { 
    var active = document.activeElement;
    jQuery(':text').focus(function () {
        if (jQuery(this).attr('placeholder') != '' && jQuery(this).val() == jQuery(this).attr('placeholder')) {
            jQuery(this).val('').removeClass('placeholder');
        }
    }).blur(function () {
        if (jQuery(this).attr('placeholder') != '' && (jQuery(this).val() == '' || jQuery(this).val() == jQuery(this).attr('placeholder'))) {
            jQuery(this).val(jQuery(this).attr('placeholder')).addClass('placeholder');
        }
    });

    jQuery(':text').blur();
    jQuery(active).focus();
    jQuery('form').submit(function () {
        jQuery(this).find('.placeholder').each(function() { jQuery(this).val(''); });
    });
}
  • 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-20T10:38:28+00:00Added an answer on May 20, 2026 at 10:38 am

    You just use a slightly different syntax for binding your event handlers. Instead of

    jQuery(':text').focus(function () {
        //do stuff here
    }.blur {
       // do other stuff here
    }
    

    you would do

    jQuery(':text').live( "focus", function() {
        //do stuff here
    }.live("blur", function() {
        //do other stuff here
    }
    

    You should also consider using delegate instead of live, if it’s possible to narrow the parts of the page you need to monitor; live can use a lot of resources. For example, if the content you’re going to load via ajax will always be within a certain div, use delegate on that div, rather than live (which will monitor the entire document).

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

Sidebar

Related Questions

I have a WPF project and I'm trying to setup a NAnt build script
Here is what im trying to achieve. I have a perl script that looks
Ok..... basically what I'm trying to do is setup something that will handle all
After trying to setup my site for Google Webmaster Tools I found that my
I am trying to setup tracd for the project I am currently working on.
I'm trying to setup a simple timer that gets started from a Rails Application.
I have a php script that comes down to the following: while ($arr =
I am creating an extension that will launch an external script based on highlighted
I have a shell script that starts tomcat using 'catalina.sh start'. This script runs
I have recently started working on a legacy application that has most of its

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.