2

Im having a problem using an isNumeric jQuery function to check if a variable is a number.

I am getting an error

Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'isNumeric'

Here is my code

var scroll = 4;
$.isNumeric(scroll);
  if (false) {
     scroll = 0;
     tabChange(menuTab, page, scroll);
  } else {
     tabChange(menuTab, page, scroll);
  }  

I thought this may be caused by having my code being run before jQuery has loaded but this is not the case.

Also the jQuery documentation is very unclear to me.

0

1 Answer 1

5

Which version of jQuery are you using? .isNumeric() was added in 1.7, and if you're using an earlier version it's not available, which would give that error.

Another possibility is that you have Prototype or some other JS library running as well - try using jQuery.isNumeric(scroll); instead of the $ notation.

Sign up to request clarification or add additional context in comments.

1 Comment

You got it Joe, i was working on someone elses work that had jQuery 1.6.2, but i didnt bother to check. Thanks :)

Your Answer

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.