‘Drupal Theming + jQuery Basics (inc. Drupal Behaviors)’

// Drupal 7 js code
(function ($) {
Drupal.behaviors.togg = {
attach: function (context, settings) {
$(‘a#togg-link:not(.togg-processed)’, context).addClass(‘togg-processed’).each(function() {
$(this).click(function() {
$(“div#togg").toggle(400);
return false;
});
});
}
};
})(jQuery);

http://www.lhmdesign.com/drupal-jquery-demo

How to reset an HTML form with jQuery

The solution

Like I already said, it’s fairly simple. As the browser already told us, jQuery has no .reset() method. But native Javascript does!

// Get the first HTML element by passing 0 to .get()
$("#review-form").get(0).reset()
// Result:
// A clean, resetted form!

Or even shorter

// Get the first HTML element by passing 0 to .get()
$("#review-form")[0].reset()
// Result:
// A clean, resetted form!

http://forwebonly.com/how-to-reset-an-html-form-with-jquery/