How to show/hide a div on mouseover using jquery?

前端 未结 6 886
别那么骄傲
别那么骄傲 2020-12-12 04:32

I have a table in this format.

div one 2222&
6条回答
  •  半阙折子戏
    2020-12-12 05:12

    First of all you have repeated ids on elements, which is wrong. use classes instead, ids should be unique

    div one 2222
    div two 2222

    then change your code

    $(function() {
      $('.divOne').hover(function() { 
        $('#Details').show(); 
      }, function() { 
        $('#Details').hide(); 
      });
    });
    

    this will end up (with your actual markup) with the result that your div will be shown when you hover on the table and it will be hidden when you don't

提交回复
热议问题