javascript - jQuery $.isNumeric throws error on console - Stack Overflow

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

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.

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.

Share Improve this question asked Feb 24, 2012 at 13:12 UndefinedUndefined 11.4k5 gold badges39 silver badges62 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745276895a4620095.html

相关推荐

  • javascript - jQuery $.isNumeric throws error on console - Stack Overflow

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

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信