Question: I want to retrieve the value of an input using jQuery.

Here's the HTML:

```
<input type="text" name="a" id="a" />
<input type="button" name="b" id="b" value="Click here"/>

```

Here's the jQuery:

```
$(document).ready(function() {

    var normal=$('#a').val();
    $('#b').on("click", function() {
            alert(normal);
  });

});

```

Due to some reason the `alert(normal);` does not work whereas `alert($('#a').val());` does. Why? Isn't `normal` and `$('#a').val();` holding the same value?

In case you want a jsfiddle: <http://jsfiddle.net/L2uX4/20/>

Thanks

Answer: 
You're assigning `normal` upon `document.ready()` and not reassigning when you click, so normal will be whatever value you give to the input field when the page loads.
Try this code 

```
$(document).ready(function() {

        $('#b').on("click", function() {
        var normal=$('#a').val();
        alert(normal);
      });

    });

```