Question: I would like to know how to declare a variable in jQuery

The code I am currently using is

```
$.name = 'anirudha';
alert($.name);

```

That code works fine, but if I write it as

```
$.name = document.myForm.txtname.value;
alert($.name);

```

Then my code does not work.

Answer: 
jQuery is just a javascript library that makes some extra stuff available when writing javascript - so there is no reason to use jQuery for declaring variables. Use "regular" javascript:

```
var name = document.myForm.txtname.value;
alert(name);

```

EDIT: As Canavar points out in his example, it is also possible to use jQuery to get the form value:

```
var name = $('#txtname').val(); // Yes, it's called .val(), not .value()

```

given that the text box has its `id` attribute set to `txtname`. However, you don't *need* to use jQuery just because you *can*.
in jquery we have to use selector($) to declare variables

```
var test=$("<%=ddl.ClientId%>");

```

here we can get the id of drop down to [j query variable](http://csharpektroncmssql.blogspot.com/2012/01/jquery-and-how-to-declare-variables.html)