notEmpty.js 781 B

123456789101112131415161718192021
  1. (function($) {
  2. $.extend($.bootstrapValidator.validator, {
  3. notEmpty: {
  4. /**
  5. * Check if input value is empty or not
  6. *
  7. * @param {bootstrapValidator} validateInstance Validate plugin instance
  8. * @param {HTMLElement} element
  9. * @param {Object} options
  10. * @returns {boolean}
  11. */
  12. validate: function(validateInstance, element, options) {
  13. var $element = $(element),
  14. type = $element.attr('type');
  15. return ('checkbox' == type || 'radio' == type)
  16. ? $element.is(':checked')
  17. : ($.trim($(element).val()) != '');
  18. }
  19. }
  20. });
  21. }(window.jQuery));