Question: What if different elements have to trigger the same function but on different events ?

```
$('#btnNext').on('click', function() { /*Same thing*/ });

$('#txtField').on('change blur', function() { /*Same thing*/ });

```

Is there any way to integrate these two lines, so I can write the same lines of code just once ?

Answer: 
```
$('#btnNext').on('click', myMethod );

$('#txtField').on('change blur',  myMethod );

function myMethod()
{
/*Your Code goes here*/
}

```
Here is a jsFiddle For You 

> 
> [Fiddle Here](http://jsfiddle.net/T2SkB/2/)
> 
> 
> 

```
 function Commonalert(){alert("Common Alert Message");}

$('#Btn').on('click', Commonalert);

$('#text').on('change blur', Commonalert);

```