So inside my <script> tags, I have these functions.
$.fn.getRandom = function(min, max) {
return min + Math.floor(Math.random() * (max - min + 1));
}
function placeRandom() {
alert(getRandom(1,7));
}
and I call the placeRandom() function like so
$(document).ready(function() {
placeRandom();
});
when I do this, it gives me an
Object expected
error and refers to the line where I wrote
alert(getRandom(1.7));
Now, my main question is if there is anything wrong with the code which I am showing you, or does it look correct? Because if it looks correct then I think i'm going to have to run through the rest of my entire code and look for maybe a open bracket which isn't closed because that might be the problem. So yea, is there any problem with my placeRandom() or getRandom() function or is the error occuring because of another reason other than these functions?
getRandomto the jQuery namespace, you will only be able to access it through a jQuery object instance or via$.fn.getRandom()getRandom, i think you just want a standard function.getRandom function(min,max)...$.fn?