|
1 | | -There are many ways to do it. |
| 1 | +راههای زیادی برای آن وجود دارد. |
2 | 2 |
|
3 | | -Here are some of them: |
| 3 | +اینجا برخی از آنها را میبینیم: |
4 | 4 |
|
5 | 5 | ```js |
6 | | -// 1. The table with `id="age-table"`. |
| 6 | +// 1. جدول یا `id="age-table"` |
7 | 7 | let table = document.getElementById('age-table') |
8 | 8 |
|
9 | | -// 2. All label elements inside that table |
| 9 | +// 2. تمام عناصر label داخل آن جدول |
10 | 10 | table.getElementsByTagName('label') |
11 | | -// or |
| 11 | +// یا |
12 | 12 | document.querySelectorAll('#age-table label') |
13 | 13 |
|
14 | | -// 3. The first td in that table (with the word "Age") |
| 14 | +// 3. اولین td داخل آن جدول (با کلمهی "Age") |
15 | 15 | table.rows[0].cells[0] |
16 | | -// or |
| 16 | +// یا |
17 | 17 | table.getElementsByTagName('td')[0] |
18 | | -// or |
| 18 | +// یا |
19 | 19 | table.querySelector('td') |
20 | 20 |
|
21 | | -// 4. The form with the name "search" |
22 | | -// assuming there's only one element with name="search" in the document |
| 21 | +// 4. form با نام "search" |
| 22 | +// با فرض اینکه فقط یک element با نام "search" در document است. |
23 | 23 | let form = document.getElementsByName('search')[0] |
24 | | -// or, form specifically |
| 24 | +// یا به طور خاص،form. |
25 | 25 | document.querySelector('form[name="search"]') |
26 | 26 |
|
27 | | -// 5. The first input in that form. |
| 27 | +// 5. اولین input درون form |
28 | 28 | form.getElementsByTagName('input')[0] |
29 | | -// or |
| 29 | +// یا |
30 | 30 | form.querySelector('input') |
31 | 31 |
|
32 | | -// 6. The last input in that form |
33 | | -let inputs = form.querySelectorAll('input') // find all inputs |
34 | | -inputs[inputs.length-1] // take the last one |
| 32 | +// 6. آخرین input در آن فرم |
| 33 | +let inputs = form.querySelectorAll('input') // تمام inputها را پیدا میکند. |
| 34 | +inputs[inputs.length-1] // آخری را میگیرد |
35 | 35 | ``` |
0 commit comments