Plain JavaScript tooltip

前端 未结 5 2014
渐次进展
渐次进展 2020-12-08 01:16

I am trying to make a tooltip in plain JavaScript which is shown on hover. Like the one in Stack Overflow on hover over the profile name a div is s

5条回答
  •  爱一瞬间的悲伤
    2020-12-08 01:34

    document.addEventListener("mousemove",function awesome(e){
    if(e.target.id != ""){
    e.target.title = "#"+e.target.id;
    }
    }); 
    random stuff
    some more random stuff

    and you can do it with lots of other stuff, like className, tagName,etc...

提交回复
热议问题