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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:29:20+00:00 2026-05-13T07:29:20+00:00

First off, here’s my code: var variable1 = 10; function f1 (){ alert(variable1); }

  • 0

First off, here’s my code:

var variable1 = 10;
function f1 (){
  alert(variable1);
}
//When button is pressed, call function
$("#button").click(f1);

Why can I not access variable1 inside the function?

$(document).ready(function() {
  var how_many_words = 3;
  alert(how_many_words); //This happens

  $("input").keypress(check_word);

  function check_word() {
    alert('hello'); //This happens
    alert(how_many_words); //This doesn't
  }
});
  • 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-13T07:29:21+00:00Added an answer on May 13, 2026 at 7:29 am

    Here’s the definitive answer to what my problem was, courtesy of this website. I foolishly named one of my variables the same as an id and a function. Insanity! I apologise for wasting people’s boxing days. Thanks for all your help.

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

Sidebar

Related Questions

First off here is my code: CREATE FUNCTION unknown_Model () RETURNS TRIGGER LANGUAGE plpgsql
First off here is the code! <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
So, first off here's my code to open the dotx and create a new
First off, I'm using XCode 4.0.2. Okay, here is my issue. I can build
First off I'm horrible with regex, hoping I can get some help here cause
First off, here's my code: Sub SimulatePortfolio() Dim lambda As Double Dim num As
I have a few questions here if anyone can help me out. First off,
Can anyone explain to me what is going on here? First off, I think
First off here is my code. IEnumerable<XElement> targetDirectory = from XElement e in workingXmlDocument.Descendants(wixNS
first off here's my current code. <div id=background> <img src=src/1080pTux.png height=100%> </div> #background{ position:fixed;

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.