Permite limpiar todos los objetos o controles de un formulario con Jquery:
$(".btnBorrar, .btnBorrar2").click(function ()
{
limpiaForm('#frmMantenedor');
$(".error").fadeOut();
$(".txtRut").focus();
return false;
});
function limpiaForm(miForm)
{
$(':input', miForm).each(function()
{
var type = this.type;
var tag = this.tagName.toLowerCase();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
}
|