-
Notifications
You must be signed in to change notification settings - Fork 231
Searching: getElement*, querySelector* #311
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
joaquinelio
merged 19 commits into
javascript-tutorial:master
from
elemarmar:search-elements-dom-emm
Jul 21, 2020
Merged
Changes from 12 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ce7cadc
Update article.md
elemarmar 62f1599
Update article.md
elemarmar ddc5556
Update article.md
elemarmar 0781af4
Update solution.md
elemarmar 81db12d
Update task.md
elemarmar ba2e0a6
Update solution.md
elemarmar 2a86f2f
Update table.html
elemarmar c236fc5
Update article.md
elemarmar 29d49ac
Update article.md
elemarmar 8aeac8a
Update solution.md
elemarmar c549aae
Update table.html
elemarmar c61abd1
Update article.md
elemarmar f22b840
Update 2-ui/1-document/04-searching-elements-dom/1-find-elements/solu…
elemarmar 1f3fb3a
Update 2-ui/1-document/04-searching-elements-dom/article.md
elemarmar e9b1d5e
Update 2-ui/1-document/04-searching-elements-dom/article.md
elemarmar 8c570c5
Update 2-ui/1-document/04-searching-elements-dom/article.md
elemarmar 5edbfd0
Update 2-ui/1-document/04-searching-elements-dom/article.md
elemarmar 269b5fa
Update 2-ui/1-document/04-searching-elements-dom/article.md
elemarmar ee7670b
Update 2-ui/1-document/04-searching-elements-dom/article.md
elemarmar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 13 additions & 13 deletions
26
2-ui/1-document/04-searching-elements-dom/1-find-elements/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
There are many ways to do it. | ||
Hay muchas maneras de resolvero. | ||
|
||
Here are some of them: | ||
Aquí hay algunas de ellas: | ||
|
||
```js | ||
// 1. The table with `id="age-table"`. | ||
// 1. La tabla con `id="age-table"`. | ||
let table = document.getElementById('age-table') | ||
|
||
// 2. All label elements inside that table | ||
// 2. Todos los elementos `label` dentro de esa tabla | ||
table.getElementsByTagName('label') | ||
// or | ||
document.querySelectorAll('#age-table label') | ||
|
||
// 3. The first td in that table (with the word "Age") | ||
// 3. El primer `td` en la tabla (con la palabra "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" in the document | ||
// 4. El `form` con name="search" | ||
// suponiendo que sólo hay un elemento con name="search" en el documento | ||
let form = document.getElementsByName('search')[0] | ||
// or, form specifically | ||
//o, utilizando el form específicamente | ||
document.querySelector('form[name="search"]') | ||
|
||
// 5. The first input in that form. | ||
// 5. El primer input en el form. | ||
form.getElementsByTagName('input')[0] | ||
// or | ||
// o | ||
form.querySelector('input') | ||
|
||
// 6. The last input in that form | ||
let inputs = form.querySelectorAll('input') // find all inputs | ||
inputs[inputs.length-1] // take the last one | ||
// 6. El último input en el form. | ||
let inputs = form.querySelectorAll('input') // encontrar todos los inputs | ||
inputs[inputs.length-1] // obtener el último | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.