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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:26:13+00:00 2026-05-13T23:26:13+00:00

Particularly the bit about live…. jQuery(‘.something’).live(‘click’, function() { jQuery(this).parent(‘form’).reset(); }); I suppose this might

  • 0

Particularly the bit about live….

 jQuery('.something').live('click', function() {
     jQuery(this).parent('form').reset();
 });

I suppose this might work as well, though I am curious about the parent function:

 jQuery('.something').live('click', function() {
     this.form.reset();
 });
  • 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-13T23:26:13+00:00Added an answer on May 13, 2026 at 11:26 pm

    Live

    Prototype doesn’t currently have “live” support. You can do something similar with event delegation, though. That’s where you watch for the event on a parent element, and then in the event handler find out which child element the event actually happened on:

    $('theFormID').observe('click', handleFormClick);
    function handleFormClick(event) {
        var element;
    
        // Get the element on which the click occurred
        element = event.findElement();
    }
    

    Event delegation is only possible with events that bubble (like ‘click’); I don’t know if jQuery’s live stuff has that same issue.

    One nice thing is that you can pass CSS selectors into Event#findElement:

    $('tbodyID').observe('click', handleTableClick);
    function handleTableClick(event) {
        var element;
    
        // Get the element on which the click occurred
        element = event.findElement('tr');
    }
    

    …which finds the tr that was clicked, even if the actual click occurred within a span inside a td inside the tr.

    Proper use of event delegation can dramatically simplify hooking/unhooking elements, particular when you’re adding and removing elements dynamically.

    I wouldn’t be surprised if there’s a plug-in for Prototype that does “live” support.

    Parent

    You mentioned that you want to get the parent of the clicked control. When you hook up a handler with Prototype, by default it sets things up so that within your handler, this references the element on which you’ve set the event handler. So for instance, if you have a div with the id foo:

    $('foo').observe('click', function(event) {
        // Here, `this` will refer to the `foo` element
    });
    

    You can then use Prototype’s Element#up to get the parent element. (If you’re using event delegation and you hook the event on the parent in the first place, of course just use this directly and if you also need to get a reference to the thing that was clicked, use #findElement as above.)

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

Sidebar

Ask A Question

Stats

  • Questions 508k
  • Answers 508k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer "The event XXX can only appear on the left hand… May 16, 2026 at 4:15 pm
  • Editorial Team
    Editorial Team added an answer You have answered your own question! Make captcha appear if… May 16, 2026 at 4:15 pm
  • Editorial Team
    Editorial Team added an answer [UIApplication sharedApplication].applicationSupportsShakeToEdit = NO; May 16, 2026 at 4:15 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm currently learning a bit more about Linq-To-Entities - particularly at the moment about
I've read the MongoDB documentation, and it comes with a warning about 32-bit systems;
Update: Now that it's 2016 I'd use PowerShell for this unless there's a really
I have a table my_table with these fields: id_a, id_b. So this table basically
A lot of what I have learned about VB I learned from using Static
i've started on some basic java coding with gwt, and im getting a bit
refering to a lot of documentation on the net, particularly on SO, eg :
I am VERY new to jQuery. Just trying to get a feel. I like
I am creating a site that utilizes the jQuery UI tabs . Whenever the
I am working on a web application (using Grails) which will generate a gift

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.