Question: I have the following html code:

```
<input type="text" id="theInput" value=""/>     
<a href="#" id="theLink">Click me</a>

```

I want to detect when the input changes and perform an operation in this case, but ONLY when the user has not clicked in the link. I have tried this:

```
$('#theLink').live('click', function(){
  alert('click');
});

$('#theInput').live('change', function(){
  alert('change');
});

```

However `change` is always executed before `click` when the value in the input changed, due to Javascript event precedence rules, and therefore only "change" message is displayed. 

I would like it to display `change` only if the input value changed and the user exited the input clicking in any other place instead of the link. In that last case I would like to display `click`.

The example is [here](http://jsfiddle.net/hTqNr/1/).

I use jQuery 1.6.4.

Answer: 
Ok, now i got it, you could do

```
$('#theLink').live('click', function(e){
    alert('click');
});

$('#theInput').live('change', function(e){
    //Check if the change events is triggerede by the link
    if(e.originalEvent.explicitOriginalTarget.data === "Click me"){
         //if this is the case trigger the click event of the link
         $('#theLink').trigger("click");
    }else{
        //otherwise do what you would do in the change handler
        alert('change');
    }
});

```

Fiddle here <http://jsfiddle.net/hTqNr/19/>
why you dont pick the value of input box. you have to store initial value of input box on ready function 

```
 initialvalue= $('#theInput').val();

```

then compare the value

```
 $('#theLink').live('click', function(){
    var newvalue =$('#theInput').val();
        if(newvalue!=initialvalue) {
            //do something
         }

  });

```