I have this code that shows popover when there is a space.
$.validator.addMethod( "regex", function(value, element, regexp) { var re = new RegExp(regexp); return this.optional(element) || re.test(value); }); $('#validateForm').validate({ rules: { product: { required: true, term: {regex: /^\s*$/} } }, messages: { product: { required: "A text is much", term: "Please avoid spaces" }, }, showErrors: function (errorMap, errorList) { $.each(this.successList, function (index, value) { $('#'+value.id+'').popover('destroy'); }); $.each(errorList, function (index, value) { $('#'+value.element.id+'').attr('data-content',value.message).popover({ placement: 'top', trigger: 'manual' }).popover('show'); }); } });
What happens, a popover is not destroyed when there are no spaces. What am I doing wrong?
jquery jquery-validate twitter-bootstrap
psharma Apr 18 '13 at 17:41 2013-04-18 17:41
source share