Basically I'm just starting my adventure with Jquery and need a bit of help from you guys.
How to shorten that code to one function cos I'm a profound believer in DRY (Don't repeat yourself).
$(".gotAccount").click(function(event){
event.preventDefault();
$(".register").fadeOut( function() {
$(".login").fadeIn('slow')
});
});
$(".dontHaveAccount").click(function(event){
event.preventDefault();
$(".login").fadeOut( function() {
$(".register").fadeIn('slow')
});
});
It simply switches two dives. In div login we have login form and a link .dontHaveAccount, and in div register we have registration form with link .gotAccount.
Thanks guys!

New Topic/Question
Reply


MultiQuote






|