• $(
    ‘#myModal’

    ).on(

    ‘hidden.bs.modal’

    , function () {






  • $(
    ‘#fm’

    ).data(

    ‘bootstrapValidator’

    ).destroy();






  • $(
    ‘#fm’

    ).data(

    ‘bootstrapValidator’

    .

    null

    );






  • clearForm($(
    ‘#fm’

    ));






  • formValidator();
    // Reload validation







  • });













  • // Clear the text box







  • function clearForm(form) {






  • / / input to empty







  • $(
    ‘:input’

    , form).each(function () {






  • var

    type =

    this

    .type;






  • var

    tag =

    this

    .tagName.toLowerCase();

    // normalize case







  • if

    (type ==

    ‘text’

    || type ==

    ‘password’

    || tag ==

    ‘textarea’

    )






  • this

    .value =

    “”

    ;






  • // Select checkboxes to clear







  • // select the dropdown box to clear







  • else
    if

    (tag ==

    ‘select’

    )






  • this

    .selectedIndex =

    – 1

    ;






  • });






  • };