I am including a jQuery file like this:
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
I am having a code like this:
if($.isNumeric(now))
{
alert("yes");
}
else
{
alert("no");
}
But when I run this script get an error:
$.isNumeric is not a function
What do I need to do?
Wrap your code in
$(document).ready(function () { //your code goes here... });Please refer to jQuery.ready() for more details.Alternatively, you can simply place your code before the
</body>.Also, you might want to try to replace $ with
jQueryand see if there’d be any conflicts in you javascript, e.g.jQuery.isNumeric("-10");If it does turn out to be conflicts, you can add this line of code,
jQuery.noConflict();at the beginning of your jQuery code. Please refer to jQuery.noConflict() for more details.Check this post on Stackoverflow which might also be helpful to you.