You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/1-document/04-searching-elements-dom/article.md
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -236,39 +236,40 @@ let divs = document.getElementsByTagName('div');
236
236
حرف `"s"` در `getElementById` وجود ندارد زیرا یک element تک را برمیگرداند. اما `getElementsByTagName` مجموعهای از عناصر را برمیگرداند، پس یک `"s"` در آن هست.
237
237
```
238
238
239
-
````warn header="It returns a collection, not an element!"
240
-
Another widespread novice mistake is to write:
239
+
````warn header="element یک مجموعه را برمیگرداند، نه یک"
240
+
یک اشتباه رایج دیگر تازهکارانه این است که بنویسیم:
241
241
242
242
```js
243
-
// doesn't work
243
+
// کار نمیکند
244
244
document.getElementsByTagName('input').value = 5;
245
245
```
246
246
247
-
That won't work, because it takes a *collection* of inputs and assigns the value to it rather than to elements inside it.
247
+
این کار نمیکند،چون یک *مجموعه* از ورودیها را میگیرد و مقدار را به جای element درون آن، به آن انتساب میدهد.
248
248
249
-
We should either iterate over the collection or get an element by its index, and then assign, like this:
249
+
ما باید یا روی آن مجموعه iterate کنیم یا یک element را با عنصر آن بگیریم و بعد به آن انتساب دهیم. مثل این:
0 commit comments