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: 
You can also use `text()` to set or get the text content of selected elements

```
var text1 = $("#idName").text();

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

```

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