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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:37:01+00:00 2026-05-27T09:37:01+00:00

So I have a class of text inputs in a form. Attached to them

  • 0

So I have a class of text inputs in a form. Attached to them is a .live click event as such:

$('.post-deal-inputs').live('click', function(e) {
$(this).val('');
$(this).unbind(e);
});

This is meant to clear the text on click but only once so that the newly entered user data is not removed. However, for some reason this does not work, it keeps clearing the text on subsequent clicks. I have also tried

.one('focus', function(e))......

but that doesn’t even fire.
Is there a way, without a switch statement to check the default text etc to make sure the text is only cleard once?

  • 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-27T09:37:02+00:00Added an answer on May 27, 2026 at 9:37 am

    Event handlers attached with live are not removed with unbind; they’re removed with die

    So try:

    $('.post-deal-inputs').die();
    

    Or, if you’ve attached other events, then

    $('.post-deal-inputs').die("click");
    

    Note that this will kill all of your events that match this selector. If you want it to only be removed from a particular item, then I would switch over to the bind unbind model. Just note that this will not work with dynamically added content

    Note that if you’re using jQuery 1.7, the preferred way of dealing with events is with on (and off)


    Because .live() is performing event delegation at the document level, if you use .die(), it will of course no longer work for any elements matching the selector.

    If you want to stop the functionality for only one element matching the original selector, just change the class of that element so that it no longer matches.

    $('.post-deal-inputs').live('click', function(e) {
        $(this).val('');
        $(this).removeClass('post-deal-inputs')
               .addClass('post-deal-inputs-clicked');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with a submit button. I have attached a click event
I have these text inputs in a table : <td><input type='text' name='arrondi_devis_ht' class='calcul_total' size='8'></td>
I have a base class Parent like this: using System; using System.Collections.Generic; using System.Text;
I'm currently styling form elements with a custom CSS class to style text inputs
I have these inputs and checkbox in a form <input class=validate[minCheckbox[1]] checkbox id=maxcheck_0 type=checkbox
I have a form in which there is a text field. The user inputs
Here's an example of what I mean: I have an array: array('type'=>'text', 'class'=>'input', 'name'=>'username',
i have a domain class like package trip.side import java.text.SimpleDateFormat class HotelStay { String
i have a class like: class myclass{ Long id; String a; Text b; }
I have a Literal class that defines a text value and an ID. I

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.