Do stuff before submitting form - jquery

Hi there,

I have a little login form in a div block that very sweetly slides down over 1/2sec when somebody clicks the "login’ button on my website. However, once they’ve entered their details, I want the box to slide up and disappear before the form goes off and logs the person in. At the moment, the block just unceremoniously disappears and none of the code is run. :nono:

Here’s the jquery:

$('form#user-login-form').submit(function() {
			'right': '9000px',
		return true;

The alert runs without a problem, but nothing inside the $(‘div#block-user-0’) block seems to run. Am I doing something silly? :blush:

BTW - I tried adding a click event listener to the submit button, but it made no difference.



slideUp() accepts an optional callback that it will execute when the animation completes. Put the stuff in there. Otherwise, the remaining code is executed immediately(probably before the animation even gets a chance to start).

A lot of the jquery animation methods offer the callback argument.

Ah awesome! that makes sense certainly.

Thanks dude!


<hands crmalibu virtual beer>