Reputation: 5872
I'm working on a beta site:http://beta.campatet.com/ I've made this lightbox script for the sign in and register. However, when I click either one of those login or register buttons, I get a very unusual error in chrome console. It says:
Uncaught SyntaxError: Unexpected token ) http://beta.campatet.com/: 1
The thing is, the error is on line 1, which is the html doctype declaration line. This boggles me, because you can't have js errors there. I believe this is causing a bug, where if you click either the "Have an account? Login" or "Register" links on the register and login windows respectively, the lightbox is unable to load the other page via ajax. I am using jQuery for the lightbox. I know that the error is caused by the lightbox code I've written, but I don't know what part. The script is at: http://beta.campatet.com/cbox/cbox.js
Any help is greatly appreciated.
BTW, I apologize for the 1 letter variable names in the js file. They originally had names that related to their respective functions, but a javascript minifier changed them, and I don't have the original.
Upvotes: 1
Views: 132
Reputation: 82654
it's the javascript: void();
don't use that. Or javascript: void(0);
void wants to evaluate something. But I might suggest replacing:
<a href="javascript:void();" onclick="$.cbox('register/', 'Register at Campatet', function(){Recaptcha.create('6Le278ESAAAAAAtQ2h08z0MwnzS3ME-jjONTobob','recaptcha_wrap', { theme: 'white'} );});">Register</a>
with:
<a href="#" onclick="[all that code] return false;">Register</a>
or better yet be unobtrusive:
$(function () {
$('a.register').click( function () {
$.cbox('register/', 'Register at Campatet', function() {
Recaptcha.create('6Le278ESAAAAAAtQ2h08z0MwnzS3ME-jjONTobob','recaptcha_wrap', { theme: 'white'} );
});
return false;
});
});
Upvotes: 3