clear all error and success div from the input and select fields by jq



function resetData(){

$("#selectorId").find(".has-error").removeClass("has-error");
$("#selectorId").find(".has-success").removeClass("has-success");
$("#selectorId").find(".FeRror").empty();
}



///////////////////////////



$('form[name="myform"] input:reset').click(function () {
    $('form[name="myform"]')
        .find(':radio, :checkbox').removeAttr('checked').end()
        .find('textarea, :text, select').val('')
     
    return false;
});





//////////////////universe function///////////////


<button type="reset" class="btn btn-primary" onclick="resetDataCaseFrwrd(this)">Clear</button>



function resetDataCaseFrwrd(obj){
$(obj).closest("form").find(".has-error").removeClass("has-error");
$(obj).closest("form").find(".has-success").removeClass("has-success");
$(obj).closest("form").find(".FeRror").empty();

}




//////////////////OR///////////////

function resetDataCaseFrwrd(obj){
$(obj).closest("form").find(".has-error").removeClass("has-error").end()
.find(".has-success").removeClass("has-success").end()
.find(".FeRror").empty().end();

}

Comments

Popular posts from this blog

datatable with both top and bottom scroll bar.

Display Loader and disable page while waiting for ajax request

Invalid bean property or is not readable to loading Jsp page