How to show button on div mouse hover

前端 未结 5 1468
暗喜
暗喜 2020-12-11 04:42

i want to show button on div hover. when i hover mouse on div then button show otherwise hide.

my button in divbutton div.

html

         


        
5条回答
  •  温柔的废话
    2020-12-11 05:23

    Use following jQuery to perform your task.

    Here is a jsfiddle demo

    $(document).ready(function () {
        $(document).on('mouseenter', '.divbutton', function () {
            $(this).find(":button").show();
        }).on('mouseleave', '.divbutton', function () {
            $(this).find(":button").hide();
        });
    });
    

提交回复
热议问题