Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
163
rated 0 times [  167] [ 4]  / answers: 1 / hits: 66181  / 11 Years ago, fri, december 13, 2013, 12:00:00

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



<div class=divbutton>
<button type=button style=display: none;>Hello</button>
</div>


when I hover mouse on div it should show but how to do that i do not know.
when I remove mouse button again hide.
Thank you.


More From » jquery

 Answers
228

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();
});
});

[#73745] Thursday, December 12, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
reed

Total Points: 725
Total Questions: 85
Total Answers: 89

Location: Singapore
Member since Sat, Jul 25, 2020
4 Years ago
;