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: 
Remember jQuery is a JavaScript **library**, *i.e.* like an extension. That means you can use both jQuery and JavaScript in the same function (restrictions apply).

You **declare/create** variables in the same way as in Javascript: `var example;`

However, you can use jQuery for **assigning values to variables**:

```
var example = $("#unique_product_code").html();

```

Instead of pure JavaScript:

```
var example = document.getElementById("unique_product_code").innerHTML;

```
```
var name = 'john';
document.write(name);

```

it will write the **variable** you have declared upper