bootstrap-select icon indicating copy to clipboard operation
bootstrap-select copied to clipboard

Validation Tag without message (empty)

Open danielrochadev opened this issue 10 years ago • 2 comments

HTML tag with the validation message is displayed even without the validation message text content. So you see a piece of visual TAG </ span> but empty.

How to TAG display only when actually exist message on it?

danielrochadev avatar Apr 14 '16 15:04 danielrochadev

duplicate of #1361

caseyjhol avatar Apr 15 '16 17:04 caseyjhol

Hi, here is a workaround :

Pure JS :

var elem = document.getElementById('_YOURELEMID_');

elem.addEventListener('invalid', function (event) {
  if(elem.validity.valueMissing) {
    elem.setCustomValidity('_YOURMESSAGE_');
  }  else {
    elem.setCustomValidity('');
}
});

With jQuery :

$('_YOURELEMID_').on('invalid', function (event) {
    if(this.validity.valueMissing) {
        this.setCustomValidity('_YOURMESSAGE_');
      }else {
    elem.setCustomValidity('');
}
})

lafleurpy avatar May 22 '16 01:05 lafleurpy