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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:07:34+00:00 2026-06-09T14:07:34+00:00

In jshint.com whenever I do var this_hold = this; I get an error. I

  • 0

In jshint.com whenever I do

var this_hold = this;

I get an error.

I get a violation of strict error.

The application is such that I need to work with either this ( passed in from an event handler) or I need to pull the element myself using document.getElementById()

It’s just how this function works best…otherwise I have to write it twice once for each case.

I want the error gone..I don’t want to turn it off. I want jshint.com 100% happy.

Here is the function in question with the violation commented

/**
 *vFlipBP - eliminate select_element in favor of 'this'
 */

function vFlipBP( element_or_string ) {
    var previous_page_element,
        previous_tag_element,
        current_page_element,
        select_element;
    console.log( 'element_or_string ' + element_or_string ); 
    if( typeof ( element_or_string ) === 'string' ) {
        select_element = document.getElementById( element_or_string );
    } else {
        select_element = this;  // violation of strict here
    }
    if( vFlipBP.previous_id === undefined ) {
        var probe_id = select_element.parentElement.firstChild.id;
        if ( ( probe_id === select_element.id ) && ( select_element.parentElement.firstChild.nextSibling ) ) {
            probe_id = select_element.parentElement.firstChild.nextSibling.id;
            vFlipBP.previous_id = probe_id;
        } else {
            vFlipBP.previous_id = select_element.id;
        }
    }
    current_page_element = document.getElementById( select_element.id + '_page' );
    current_page_element.style.display = '';
    select_element.style.background = "#eeeeee";
    if( vFlipBP.previous_id !== select_element.id ) {
        previous_page_element = document.getElementById( vFlipBP.previous_id + '_page' );
        previous_tag_element = document.getElementById( vFlipBP.previous_id );
        if( ( ( previous_page_element !== current_page_element ) ) && ( previous_page_element !== null ) ) {
            previous_page_element.style.display = 'none';
            previous_tag_element.style.background = "#ffffff";
        }
    }
    vFlipBP.previous_id = select_element.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-06-09T14:07:35+00:00Added an answer on June 9, 2026 at 2:07 pm

    You can use an option validthis to turn off that warning. Unfortunately, you can’t detect all strict mode violations just by doing static analysis so JSHint makes a guess—and sometimes it is wrong.

    More about validthis and other options in our docs: http://www.jshint.com/docs/

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

Sidebar

Related Questions

Jshint.com is giving the error: Line 36: var signin_found; Missing use strict statement.
The code: var foo = /\</; When I go to jslint.com and enter that
Jshint.com suggests this for the code below: Line 150: }, false ); Don't make
It's difficult to describe the application but basically I need to send 'this' as
I get this error: JSON.parse: unexpected character when I run this statement in firebug:
JSLint is giving me this error: Problem at line 11 character 33: Use the
I wrote the following code for a project that I'm working on: var clicky_tracking
I am getting several 'undefined' errors when running this code in JSHint: MERLIN.namespace('MERLIN.http'); MERLIN.http
Our application allows users to upload javascript, CSS, and HTML files. We need a
JSHint is telling me that my methods are not recognized if they are not

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.