Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change default input tooltip text that shows in required input

There is a tooltip when my mouse is over the textbox : "please fill out this field" is there a way too change this text ?

if you hover on this field you can see the massage :

<input type="text" name="yourname" required/>
like image 967
inaz Avatar asked Oct 21 '25 05:10

inaz


1 Answers

This could be easily done using the title HTML attribute.

title Attribute

The title attribute belongs to the Global Attribute. It allows to specify extra information about an element. This information is shown as a tooptip text when the mouse moves over the element.

<input type="text" name="yourname" required title="You changed it !!"/>

If its something related to the text showed after validation. For that you could use the function setCustomValidity along with an event Handler . Here we would use the event Handler oninvalid.

Your code could be written as :

<input type="text" name="yourname" required oninvalid="this.setCustomValidity('Yo! You changed it')" oniput="this.setCustomValidity('Yo! You changed it')" title="test"/>
like image 102
Nithin Suresh Avatar answered Oct 23 '25 18:10

Nithin Suresh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!