How to remove standard validation tooltip after .reportValidity() using css
Any ideas?
How to remove standard validation tooltip after .reportValidity() using css
Any ideas?
The keyword is: "standard". It's not possible to modify (this includes hiding) the actual tooltip because it's a browser native implementation, at least, not possible for major browser engines like Blink, Webkit and Gecko, namely Chromium, Safari and Firefox respectively.
References:
.reportValidity()
behaviour: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#report-validity-steps<form novalidate> ... </form>
You can hide the validation tooltip by setting a custom validation message that is all whitespace. I'm not sure if it is documented somewhere or if it is a bug, but it works in Chrome and Firefox. I haven't tested other browsers.
const input = document.getElementById("name");
input.setCustomValidity(" ");
document.getElementById("btn").onclick = () => input.reportValidity();
<input id="name" placeholder="Name" required>
<button id="btn">Report validity</button>