0

Failed to customize the browser default title position of a input field using Javascript.

function myFunction() {
  document.getElementById("myP").title = "Title Top the input field";
  //document.getElementById("myP").title.position=  'top'; //Wrong
}
<!DOCTYPE html>
<html>

<body>
  <input id="myP" title="Title below the input field" />
  <button onclick="myFunction()">Try it</button>
</body>

</html>
RaJesh RiJo
  • 4,302
  • 4
  • 25
  • 46
koushik
  • 27
  • 5
  • In my eyes it is not possible, because this comes from browser. If you want to have a different tooltip, you have to develop it by yourself (or using an framework) – Reporter Aug 23 '17 at 11:55
  • You failed, because what you want is impossible ... no idea what even made you think this was possible in the first place. If you want a tooltip that allows you to specify such stuff, you need to use a custom solution that create and positions HTML elements to achieve the effect. Related: https://stackoverflow.com/questions/9927640/styling-native-tooltip-from-title-tooltip-text – CBroe Aug 23 '17 at 11:55
  • 2
    https://stackoverflow.com/a/17579580/4108884 - this actually can achieve it. Just manipulate the top, bottom, left, right of a[title]:hover:after as you see fit. – Samuil Petrov Aug 23 '17 at 11:56
  • @SamuilPetrov, The issue I am facing is that the default tooltip is overlying on my custom tooltip which is showing the value of the input field if it had a long text. – koushik Aug 23 '17 at 12:15
  • this is what you can do ,clone you button ,set it's new tool tip and add it to div and then remove previous button – Vijay Parmar Aug 23 '17 at 12:53

0 Answers0