Bind with data and event handler - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:bind

Description

Bind with data and event handler

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>
function handlerName(e){//from w  w w .  ja  v a 2s  .c o  m
    console.log(e.data.msg);
}
$(document).ready(function(){
    $("p").bind("click", {msg: "You just clicked me!"}, handlerName)
});
</script>
</head>
<body>

<p>Click me!</p>

</body>
</html>

Related Tutorials