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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:58:54+00:00 2026-05-23T07:58:54+00:00

I have a plugin, jKey, and people kept reporting IE bugs that it didnt

  • 0

I have a plugin, jKey, and people kept reporting IE bugs that it didnt work. The bug isn’t with my script, or jQuery, but rather IE doesn’t support window keypresses. I want to “auto-correct” this by checking if the $(window) was selected (which i did below by check, if “this” has a parentNode) and if it was i want to switch this to document.

I’m having no luck tho. I keep getting:

Uncaught ReferenceError: Invalid left-hand side in assignment

I’ve tried:

if($(this)[0].parentNode == undefined){
    $(this) = $(document);
}

And:

if($(this)[0].parentNode == undefined){
    this = document;
}

Any ideas? Also, if you have a better way of checking for the window please let me know!

  • 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-23T07:58:55+00:00Added an answer on May 23, 2026 at 7:58 am
    • $ is a function. $(this) is a function invocation. You cannot assign a value to a function invocation.
    • this never directly assignable.
    • Are you really jQuery-ifying this and then immediately unwrapping it?

      $(this)[0].parentNode
      // is exactly equivalent to
      this.parentNode
      

    Also, if you have a better way of checking for the window please let me know!

    In the plugin, alias this to a keyword that you can assign. A frequent choice is self:

    // plugin entry point
    var self = this;
    
    // use self instead of this throughout the rest of the plugin
    

    Now you actually can change the “scope:”

    if (!this.parentNode) {
        self = document;
    }
    

    your snippet seems to convert all selections to document? not just window? so $('input') is converted to document

    Oh, right, you’re talking about a jQuery plugin. this is probably already a jQuery object, in which case this.parentNode would always be a falsy value. You can either unwrap it:

    if (!this[0].parentNode) {
        self = $(document);
    }
    

    or use

    if (this.first().parent().length) {
        self = $(document);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this jquery plugin that zooms in on photos, but I would like
does jquery have any plugin that prevents entering any input to a textbox that
Does jQuery validation plugin have some dependencies? For example, I saw blogposts that said
I have a parseuri jQuery plugin method that affects the .val() of an input
I have a plugin for an RCP app that uses BIRT. I have a
I have a plugin that is loaded by this application.. This plugin calls some
We have a plugin system on a WCF service that checks libraries placed in
I have a plugin that uses the .live method (now deprecated) to execute code
I have a plugin tag [crayon ...] that may or may not be rendered
I have a plugin module that goes into a web application. If the module

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.