0

I am getting this error while function call:

Error:"0x800a138f - Microsoft JScript runtime error: The value of the property 'function1' is null or undefined, not a Function object"

function1 is getting called on click of a button

Irvin Dominin
31k9 gold badges82 silver badges114 bronze badges
asked Jun 25, 2013 at 6:19
3
  • Seems like you missed () in method calling Commented Jun 25, 2013 at 6:23
  • post the code so that we can evaluate and track what causes the error Commented Jun 25, 2013 at 6:23
  • Please post the full stack trace, so that we can see who's calling at the wrong moment. Commented Jun 25, 2013 at 6:29

2 Answers 2

1

Your script is not executed when the DOM is ready. You should adjust your code like this..

$(function() {
 $("#button").click( function() {
 alert('button clicked');
 });
});
davidcondrey
36.3k18 gold badges119 silver badges138 bronze badges
answered Jun 25, 2013 at 6:24

Comments

0

It can be several things but since I dont have your code and I see you using jQuery I would recommend to do the following:

  1. As Sagar Vaghela said, your JS code may be executed when the DOM element is not ready, to solve this you should as good practice wrap your code in $(document).ready(function () {//Your code goes here}).
  2. I also recomend to play with your jQuery selector when the web page is ready so you are certain that you are using the proper selector, you cant imagine how many times I could have failed on this last one.
  3. And last you should be sure that your JS file is being loaded by setting a breakpoint somewhere in the code using Firebug or Google Chrome dev tools.

I hope this helps :)

answered Jun 25, 2013 at 6:30

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.