How to change content of div on hover using JQuery/Javascript

后端 未结 6 1094
醉酒成梦
醉酒成梦 2021-01-29 16:37

I\'m trying to change the contents of a div when it\'s hovered over using JQuery. I\'ve seen answers on stack overflow, but I can\'t seem to get it working.

I\'ve tried

6条回答
  •  走了就别回头了
    2021-01-29 17:16

    Easy solution,

    var s = document.getElementsByTagName('div');
    function out() {
     s[0].innerHTML = 'hello';
    }
    
    function ibn() {
     s[0].innerHTML = 'Myname';
    }
    Myname

提交回复
热议问题