up
This commit is contained in:
parent
ab9ab64bd5
commit
97c8f22bbb
289 changed files with 195 additions and 172 deletions
|
@ -1,36 +0,0 @@
|
|||
There are many ways to do it.
|
||||
|
||||
Here are some of them:
|
||||
|
||||
```js
|
||||
// 1. The table with `id="age-table"`.
|
||||
let table = document.getElementById('age-table')
|
||||
|
||||
// 2. All label elements inside that table
|
||||
table.getElementsByTagName('label')
|
||||
// or
|
||||
document.querySelectorAll('#age-table label')
|
||||
|
||||
// 3. The first td in that table (with the word "Age").
|
||||
table.rows[0].cells[0]
|
||||
// or
|
||||
table.getElementsByTagName('td')[0]
|
||||
// or
|
||||
table.querySelector('td')
|
||||
|
||||
// 4. The form with the name "search".
|
||||
// assuming there's only one element with name="search"
|
||||
let form = document.getElementsByName('search')[0]
|
||||
// or, form specifically
|
||||
document.querySelector('form[name="search"]')
|
||||
|
||||
// 5. The first input in that form.
|
||||
form.getElementsByTagName('input')
|
||||
// or
|
||||
form.querySelector('input')
|
||||
|
||||
// 6. The last input in that form.
|
||||
// there's no direct query for that
|
||||
let inputs = form.querySelectorAll('input') // search all
|
||||
inputs[inputs.length-1] // take last
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue