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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:07:11+00:00 2026-05-24T09:07:11+00:00

For some reason I can’t refer to the element I’m editing as $(this) when

  • 0

For some reason I can’t refer to the element I’m editing as $(this) when I use the onreset handler.

However, I can use use $(this) in my callback. I’m sure onreset works because I’ve done an alert. Furthermore, when I do an alert on $(this).attr('id') I get “undefined”.

What’s going on?

CODE

    $('.edit').editable('ajax/save.php?editnotetext', {
                type : 'mce',
                submit : '<button class="save_button">Save</button>',
                cancel : '<button class="cancel_button">Cancel</button>',
                event: 'dblclick',
                placeholder : 'Doubleclick to edit...',
                indicator : 'Saving...',
                tooltip : 'Doubleclick to edit...',
                onblur: 'custom',
                callback : function(){
                          console.log('unlocked');
                          $.post('ajax/save.php?unlocknotetext', {"id" : $(this).attr('id')});
                },
                onreset : function(){
                          console.log('unlocked');
                          //myId = $(this).attr('id');
                          //alert(myId); this shows up as undefined!
                          //alert("onreset works!");
                          $.post('ajax/save.php?unlocknotetext', {"id" : $(this).attr('id')});
                }

});
  • 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-24T09:07:12+00:00Added an answer on May 24, 2026 at 9:07 am

    this comment seems to explain it:

    It seems inside onreset and onsubmit, this points to the form, not its container, so you have to use $(this).parent() instead.

    An easy fix would be to do this:

    $('.edit').each(function() {
        var $this = $(this);
        $this.editable(... /* use $this instead of $(this) here*/)
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason I can't get this script to run when I add the
This is probably very easy to do but for some reason I can't seem
An easy problem, but for some reason I just can't figure this out today.
for some reason I can't get my tableview to enter editing mode. It's a
For some reason I can't use \n to create a linefeed when outputting to
For some reason i can't seem to get this right ok i have 2
This should be pretty simple but for some reason I can't get this value
I have this code. For some reason I can't get the contentpresenter to stretch
For some reason I can't use runat=server as an attribute for the input tag
this is a dumb question but for some reason i can't figure it out

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.