Reputation: 4147
So I am trying to get my form to work. I have two errors I am getting and can't figure out where exactly they are happening. The first one is:
Uncaught RangeError: Maximum call stack size exceeded
e.extend.each
$.extend.ready
$.extend.ready
$.extend.ready... //there are literally 50+ more $.extend.ready scripts below this
This error has to deal with the jquery file as I deleted the other two to find out where it came from and the error disappeared when I deleted the jquery file. The file is jquery-1.7.1min.js. I can't use a later edition for purposes out of my control.
and the second one is:
too much recursion:
if ($.browser.mozilla || $.browser.opera) {
document.removeEventListener("DOMContentLoaded", $.ready, false);...//the first line basically
I did a search on both of course but the problems don't seem to relate to whatever error is in my script. I have a form I am trying to get to run and I feel these two issues are probably causing the problem. The "clear" and "submit" buttons aren't working so trying to knock out the problems I know, and these are the last two that I have.
OK I found where an issue was:
$(function () { //this is the way to run your code at the DOM Ready event
$('a').click(function () {
$('html, body').animate({ //this is line 8
scrollTop: $($(this).attr('href')).offset().top
}, 1500);
return false;
});
});
SCRIPT5007: Unable to get property 'top' of undefined or null reference script.js, line 8 character 9
what could this be then?
Upvotes: 1
Views: 326
Reputation: 339816
If your href
attribute is pointing at a named anchor (e.g. <a name="foo">
) that uses the name
attribute then you cannot use #foo
to resolve it, because #
in a selector matches the id
attribute, not the name
attribute.
In your case, since #foo
doesn't exist, $('#foo').offset()
will produce an empty object with no .top
property.
You could:
id
attribute instead of name
on the anchor, or$([name=...])
selector (having stripped off the leading #
), or.data()
function to point at the desired element.Upvotes: 1