Skip to content

Commit a1d8278

Browse files
authored
Merge pull request #254 from Dorin-David/Article/dom-searching
Searching: getElement*, querySelector*
2 parents 131dfcf + f19fdec commit a1d8278

File tree

3 files changed

+112
-112
lines changed

3 files changed

+112
-112
lines changed
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
There are many ways to do it.
1+
Ci sono molti modi per farlo.
22

3-
Here are some of them:
3+
Eccone alcuni:
44

55
```js
6-
// 1. The table with `id="age-table"`.
6+
// 1. La tabella con `id="age-table"`.
77
let table = document.getElementById('age-table')
88

9-
// 2. All label elements inside that table
9+
// 2. Tutti gli elementi label dentro la tabella
1010
table.getElementsByTagName('label')
11-
// or
11+
// oppure
1212
document.querySelectorAll('#age-table label')
1313

14-
// 3. The first td in that table (with the word "Age")
14+
// 3. Il primo td dentro la tabella (con la parola "Age")
1515
table.rows[0].cells[0]
16-
// or
16+
// oppure
1717
table.getElementsByTagName('td')[0]
18-
// or
18+
// oppure
1919
table.querySelector('td')
2020

21-
// 4. The form with the name "search"
22-
// assuming there's only one element with name="search" in the document
21+
// 4. La form con il nome "search"
22+
// supponendo ci sia solo un elemento con name="search" nel documento
2323
let form = document.getElementsByName('search')[0]
24-
// or, form specifically
24+
// oppure, form specificamente
2525
document.querySelector('form[name="search"]')
2626

27-
// 5. The first input in that form.
27+
// 5. Il primo input contenuto in form.
2828
form.getElementsByTagName('input')[0]
29-
// or
29+
// oppure
3030
form.querySelector('input')
3131

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. L'ultimo input in form
33+
let inputs = form.querySelectorAll('input') // trova tutti gli input
34+
inputs[inputs.length-1] // prendi l'ultimo
3535
```

2-ui/1-document/04-searching-elements-dom/1-find-elements/task.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ importance: 4
22

33
---
44

5-
# Search for elements
5+
# Ricerca degli elementi
66

7-
Here's the document with the table and form.
7+
Abbiamo un documento con una tabella e un form.
88

9-
How to find?...
9+
Come trovare?...
1010

11-
1. The table with `id="age-table"`.
12-
2. All `label` elements inside that table (there should be 3 of them).
13-
3. The first `td` in that table (with the word "Age").
14-
4. The `form` with `name="search"`.
15-
5. The first `input` in that form.
16-
6. The last `input` in that form.
11+
1. La tabella con `id="age-table"`.
12+
2. Tutti gli elementi `label` dentro la tabella (dovrebbero essercene 3).
13+
3. Il primo `td` nella tabella (con la parola "Age").
14+
4. Il `form` con `name="search"`.
15+
5. Il primo `input` nel form.
16+
6. L'ultimo `input` nel form.
1717

18-
Open the page [table.html](table.html) in a separate window and make use of browser tools for that.
18+
Apri la pagina [table.html](table.html) in un'altra finestra e utilizza gli strumenti del browser.

0 commit comments

Comments
 (0)