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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:55:19+00:00 2026-05-30T13:55:19+00:00

How do you redefine this in a jQuery click event handler? I read a

  • 0

How do you redefine this in a jQuery click event handler? I read a few years ago that Edge had an optional parameter that you could pass in to have this bound to something else, but does not seem to be the case any longer.

  • 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-30T13:55:20+00:00Added an answer on May 30, 2026 at 1:55 pm

    There are two common ways. I prefer using jQuery.proxy

    $.fn.highlighter = function(){
        this.click($.proxy(function(){
            this.addClass('highlight');
        }, this));
    };
    

    The other common alternative is to assign this to self inside the function where you call the click handler.

    $.fn.highlighter = function(){
        var self = this;
        this.click(function(){
            self.addClass('highlight');
        });
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read a lot that LISP can redefine syntax on the fly, presumably
Is it possible to create an event listener in jQuery that can be bound
I want to redefine the \part* command so that it automatically adds a contents
What special method(s?) should I redefine in my class so that it handled AttributeError
I'm working on this page: http://sydneypadua.com/2dgoggles/ And I'm trying to redefine the width of
I'm trying to redefine the SessionID of a ColdFusion session, is this possible?
This is the update that just came out this week (2010-05-18). Somebody moved my
I need to redefine the jQuery val() function, but I don't want to mess
I'm trying to redefine this C structure to Lua with alien 0.50 module however
I'm trying to redefine exception handler for a couple of my controllers in Zend

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.