diff --git a/2-ui/4-forms-controls/1-form-elements/article.md b/2-ui/4-forms-controls/1-form-elements/article.md index 261074a1ba..f99bd482c3 100644 --- a/2-ui/4-forms-controls/1-form-elements/article.md +++ b/2-ui/4-forms-controls/1-form-elements/article.md @@ -8,19 +8,11 @@ 폼은 특수한 컬렉션인 `document.forms`의 구성원입니다. -<<<<<<< HEAD -`document.forms`는 이름과 순서가 있는 '기명 컬렉션(named collection)'입니다. 개발자는 이 이름이나 순서를 사용해 문서 내의 폼에 접근할 수 있습니다. +`document.forms`는 이름과 순서가 있는 *'기명 컬렉션(named collection)'* 입니다. 개발자는 이 이름이나 순서를 사용해 문서 내의 폼에 접근할 수 있습니다. ```js no-beautify -document.forms.my - 이름이 'my'인 폼 -document.forms[0] - 문서 내의 첫 번째 폼 -======= -That's a so-called *"named collection"*: it's both named and ordered. We can use both the name or the number in the document to get the form. - -```js no-beautify -document.forms.my; // the form with name="my" -document.forms[0]; // the first form in the document ->>>>>>> upstream/master +document.forms.my; // 이름이 'my'인 폼 +document.forms[0]; // 문서 내의 첫 번째 폼 ``` 이름이나 순서를 사용해 원하는 폼을 가져온 다음에는 기명 컬렉션 `form.elements`를 사용해 폼의 요소를 얻을 수 있습니다. @@ -44,15 +36,9 @@ document.forms[0]; // the first form in the document ``` -<<<<<<< HEAD -그런데 개발을 하다 보면 이름이 같은 요소 여러 개를 다뤄야 하는 경우가 생기기도 합니다. 라디오 버튼을 다룰 때 이런 상황이 자주 발생하죠. +그런데 개발을 하다 보면 이름이 같은 요소 여러 개를 다뤄야 하는 경우가 생기기도 합니다. 라디오 버튼이나 체크박스를 다룰 때 이런 상황이 자주 발생하죠. -이때 `form.elements[name]`은 컬렉션이 된다는 사실을 이용할 수 있습니다. 예시를 살펴봅시다. -======= -There may be multiple elements with the same name. This is typical with radio buttons and checkboxes. - -In that case, `form.elements[name]` is a *collection*. For instance: ->>>>>>> upstream/master +이때 `form.elements[name]`는 *컬렉션*이 된다는 사실을 이용할 수 있습니다. 예시를 살펴봅시다. ```html run height=40
@@ -133,11 +119,7 @@ alert(ageElems[0]); // [object HTMLInputElement] ``` -<<<<<<< HEAD 그런데 폼 요소의 이름을 변경하는 일은 드물기 때문에 보통은 이런 특징이 문제가 되지 않습니다. -======= -That's usually not a problem, however, because we rarely change names of form elements. ->>>>>>> upstream/master ```` @@ -173,11 +155,7 @@ That's usually not a problem, however, because we rarely change names of form el ### input과 textarea -<<<<<<< HEAD -input과 textarea 요소의 값은 `input.value` (string) 또는 `input.checked`(boolean)을 사용해 얻을 수 있습니다. -======= -We can access their value as `input.value` (string) or `input.checked` (boolean) for checkboxes and radio buttons. ->>>>>>> upstream/master +input과 textarea 요소의 값은 `input.value` (string)로 얻을 수 있고, 체크박스와 라디오 버튼의 경우 `input.checked`(boolean)를 사용해 선택 여부를 확인할 수 있습니다. 이렇게 말이죠. @@ -198,33 +176,17 @@ input.checked = true; // 체크박스나 라디오 버튼에서 쓸 수 있습 ``의 값을 설정할 수 있습니다. -<<<<<<< HEAD -1. 조건에 맞는 ` 가 생성됩니다. ``` -<<<<<<< HEAD -이번엔 같은 요소를 선택된 상태로 생성합니다. -======= -The same option, but selected: ->>>>>>> upstream/master +이번엔 같은 요소를 선택된 상태로 생성해 봅시다. ```js let option = new Option("Text", "value", true, true); @@ -358,15 +289,9 @@ Option을 사용해 만든 요소에는 다음과 같은 프로퍼티가 있습 `element.form` : 요소는 `form` 프로퍼티에서 자신이 속한 폼을 참조합니다. -<<<<<<< HEAD -각 요소의 값은 `input.value`, `textarea.value`, `select.value` 등으로 접근할 수 있습니다. 체크박스와 라디오 버튼에서는 `input.checked`를 사용할 수 있습니다. - -``, one can also get the value by the index `select.selectedIndex` or through the options collection `select.options`. ->>>>>>> upstream/master +``, `