[jQuery] consistently unable to get return false to work, why?
So, this isn't related to any one bit of code, but it seems to be a
problem I run into almost everytime i need to stop a form or link for
doing what it was originally intended to do (submit).
Now, i have used return false; many times, but it never works at
first.
I'm never sure what I end up changing, but something changes, and then
all of a sudden it works, and I am once again left stumped as to what
I did.
Yesterday, i renamed a class, and all of a sudden, it worked. Changed
the class back, and guess what! It still works, though it hadn't
before ...ggggrrrrr
Today, i'm trying to use a submit, check the e-mail address and then
submit the form via ajax.
Once again, i can't seem to stop the form from submitting.
There are no other javascript errors coming up in firefox.
my alerts work, so i'm in the right function, but then...the form
submits.
<code>
jQuery('div#selected form#getEmail').livequery('submit', function
(){
var sid=jQuery('input.emailsButton', this).attr('id');
var emailAddress=jQuery('input#email', this).val();
alert(sid);
if(isValidEmailAddress(emailAddress)) {
alert('works');
$("input#email).after("works");
} else {
alert('errored');
$("input#email, this").after("<label class='error'>Email is not
valid!</label>");
}
return false;
});
</code>
I've tried moving the return false; into the if/else, but no changes.
As mentioned, i think the biggest problem isn't just with this code.
There is something I seem to be doing consistently.
Thanks