Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Searching: getElement*, querySelector*#246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tarasyyyk merged 1 commit intojavascript-tutorial:masterfromNordtonito:master
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
There are many ways to do it.
Є багато способів зробити це.

Here are some of them:
Ось деякі з них:

```js
// 1.The table with `id="age-table"`.
// 1.Таблиця з `id="age-table"`.
let table = document.getElementById('age-table')

// 2.Alllabelelements inside that table
// 2.Всі елементиlabelвсередині цієї таблиці
table.getElementsByTagName('label')
//or
//або
document.querySelectorAll('#age-table label')

// 3.The firsttdin that table (with the word "Age")
// 3.Першийtdв цій таблиці (зі словом "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 withname="search" in the document
// 4.форма з іменем "search"
//припускаємо, що в документі є лише один елемент зname="search".
let form = document.getElementsByName('search')[0]
//or, form specifically
//або безпосередньо форма
document.querySelector('form[name="search"]')

// 5.The firstinputin that form.
// 5.Першийinputу цій формі.
form.getElementsByTagName('input')[0]
//or
//або
form.querySelector('input')

// 6.The lastinputin that form
let inputs = form.querySelectorAll('input') //find all inputs
inputs[inputs.length-1] //take the last one
// 6.Останнійinputу цій формі
let inputs = form.querySelectorAll('input') //знайти всі input
inputs[inputs.length-1] //взяти останній
```
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,17 +2,17 @@ importance: 4

---

#Search for elements
#Пошук елементів

Here's the document with the table and form.
Ось документ із таблицею та формою.

How to find?...
Як знайти?...

1.The table with `id="age-table"`.
2.All`label`elements inside that table (there should be 3 of them).
3.The first`td`in that table (with the word "Age").
4.The`form`with `name="search"`.
5.The first`input`in that form.
6.The last`input`in that form.
1.Таблиця з `id="age-table"`.
2.Усі елементи`label`всередині цієї таблиці (їх має бути 3).
3.Перший`td`у цій таблиці (зі словом "Age").
4. `form`з `name="search"`.
5.Перший`input`у цій формі.
6.Останній`input`у цій формі.

Open the page[table.html](table.html)in a separate window and make use of browser tools for that.
Відкрийте сторінку[table.html](table.html)в окремому вікні та скористайтеся для цього інструментами браузера.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp