trigger the mousedown event for the selected elements: - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:mousedown

Description

trigger the mousedown event for the selected elements:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").mousedown(function(){
        $("p").slideToggle();
    });//from w  w w .  j av  a2 s.c  om
    $("div").mouseover(function(){
        $("button").mousedown();
    });
});
</script>
</head>
<body>
<div>Mouse over this text to trigger the mousedown event for the button above.</div>
<p>This is a paragraph.</p>
<button>Toggle</button><br><br>
</body>
</html>

Related Tutorials