Question: I want to Pass the variable with click event in jquery

```
var get=3; 
$('#edit').click(function(event){
alert('You are getting:' + get);
}

```

please help me

html 

```
<input type='submit' name='action' id='edit' />

```

Answer: 
Initiate everything after document is ready.

```
$(document).ready(function() {
    var get = 3; 
    $('#edit').click(function(event){
        alert('You are getting:' + get);
    });
});

```

also don't use event handlers until you need it.
Can you try like this, 

```
<script type="text/javascript">
  function test(ev) {
    var id = $(ev).attr('id');
    alert(id);
  }
</script>

<input id="btn" type="button" value="click" OnClick="test(this);" />

```