Friday, 5 December 2014

Clear all input control using Jquery

 //clear all controls
           function clear() {
               try {
               
                   $('input[type=text]').each(function () {
                       $(this).val('');
                   });
                   $('select').prop('selectedIndex', 0);
                   $('textarea').each(function () {
                       $(this).val('');
                   });
                   $('input[type=checkbox]').each(function () {
                       $(this).prop('checked', false);
                   });


               } catch (e) {
                   alert(e.message);

               }
           }

No comments:

Post a Comment