I am creating above text box in my JSP file which getting populated in javascript(basically content inside textbox is dynamic not static). I want to display the content of text box when I take mouse over text box. Is there any function in javascript I can use for it?
Share
Use the
onmouseoverevent handler. Modify the input’s text using thevalueproperty. You can also use anonmouseoutevent handler to clear the text when the mouse leaves the input if you need it. See it in this fiddle.For instance:
Just in case you’d like to do the same thing when the
<input>gets/loses the focus (by TAB for instance), use theonfocusandonblurevent handlers.UPDATE It turns out the OP wanted to dynamically change the
titleattribute of the input, so that it pops up in a tooltip when the mouse hovers over it. This can be achieved adding anonkeyuponinputevent handler to the component that setsthis.titletothis.value. Learn more aboutoninputhere.