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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:22:15+00:00 2026-06-12T07:22:15+00:00

I apologize for this rather BASIC question, but I am at whits end here!

  • 0

I apologize for this rather BASIC question, but I am at whits end here!

I have a javascript function that I want to run when the page loads… simple right? I have tried putting the function in doc readys, window readys, putting it before and after the main function, etc etc. NOTHING seems to work.

Code so far:

function calcme() {         
    DA FUNCTON
    }

$(document).ready(function(){   
    calcme();
    $("input").bind("keyup", calcme);

});

Please note… the keyup bind DOES work, but I need the calcme function to load on page load. Thoughts?

UPDATE: As per request, here is the full fiddle. http://jsfiddle.net/vpsSA/

  • 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-12T07:22:17+00:00Added an answer on June 12, 2026 at 7:22 am

    Problem found: The calcme() function assumes it is called from the context of one of the inputs and uses this.value inside. So, when you call it without any arguments, it obviously fails. This can be solved by trigger the keyup of each of your inputs, instead of calling calcme() directly. See the fiddle below.

    Working fiddle: http://jsfiddle.net/vpsSA/1/


    In your ready() handler, the bind statement comes after the caclme() call. And as you mentioned the event binding worked. This means:

    a) calcme() was definitely executed on load. There is no other way since you’ve mentioned that the binding statement which comes after the calcme() call worked as expected.

    b) calcme() did not throw any JS errors – if so, it would have stopped at the error and the event binding would not have taken place. Maybe it threw a warning, which you’ll be able to see in your JS console.

    c) Since you haven’t provided whats inside calcme(), we can’t say for sure. But what it looks like is some sort of condition failure because of which you did not get the expected result from calcme() when running on load. Are you using anything inside calcme() thats initialized after running it on load. I would suggest putting in a debugger; statement as the first line in your ready() handler and tracing it in Firebug or Chrome.

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

Sidebar

Related Questions

I apologize that this isn't a question on how to use Mathematica, but rather
I apologize since this is rather a n00bish question, but I can't figure this
This question is going to be rather long, so I apologize preemptively. In Python
I have a case similar to this MySQL question regarding the IN clause, but
I apologize if this question has been answered already, but I cannot seem to
I apologize in advance about asking a so similar question, but i'm rather frustrated,
I apologize if this is an obvious question, but I'm going through the Java
This question is prob a duplicate (but I can't find it) so I apologize
Apologies for the rather verbose and long-winded post, but this problem's been perplexing me
I apologize for this seemingly relatively simple task that I can't figure out. I

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.