The most important aspects that deals with events via jQuery is blind() method. From the name itself, it is used to attach one or more events on a set of elements. It is a method specifies a function to run while the event occurs. This method will be used together with other events.

Syntax for bind() method

$(selector).bind(event,data,function,map)

The parameters of bind() methods are event, data, function and map. Here, event and data parameters are mandatory.

Example of jquery bind()

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("p").bind("click", function(){
    alert("Given paragraph was clicked.");
  });
});
</script>
</head>
<body>
<p>Click me!</p>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *