Two useful jQuery scripts for forms

Here are two useful jQuery scripts for online forms.

The first is to prevent double submission of a form a.k.a. ‘anti-double-click’.

$("form").submit(function() {
$(":submit",this).attr("disabled", "disabled");
});

The second is a script to disable auto complete for all fields in a form:

$('input[type=text]').attr('autocomplete', 'off');

 

Hope this helps,