====== HTMLFormElement.reset() ====== * description : HTMLFormElement.reset() * author : 오션 * email : shlim@repia.com * lastupdate : 2022-12-23 Fri \\ ===== HTMLFormElement.reset() ===== The HTMLFormElement.reset() method restores a form element's default values. This method does the same thing as clicking the form's control.\\ HTMLFormElement.reset() 메소드는 form 요소의 기본 값을 복원합니다. 이 메소드는 form의 컨트롤을 클릭하는 것과 같은 역할을 합니다. If a form control (such as a reset button) has a name or id of reset it will mask the form's reset method. It does not reset other attributes in the input, such as disabled.\\ reset 버튼과 같은 form 컨트롤은 reset 이름 또는 id가 있는 경우, form의 reset 메소드를 가릴 것입니다(? 막다라는 의미로 추정) input의 다른 속성들, 예를 들어 disabled와 같은 속성들을 reset하지 않습니다. Note that if setAttribute() is called to set the value of a particular attribute, a subsequent call to reset() won't reset the attribute to its default value, but instead will keep the attribute at whatever value the setAttribute() call set it to.\\ \\ **''setAttribute()로 특정 속성의 값을 설정하고, reset()을 호출하면 속성을 기본값으로 reset()할 수 없고,''**\\ **''계속 setAttribute() 호출이 설정한 값으로 속성을 유지합니다.''**\\ ===== 작성 이유 ===== 업무 프로세스 등록 모달에서 여러 항목을 입력하고, 중요도 표시(별 아이콘)를 하고 -- 특히 첫 번째 항목 -- 등록을 하지 않고\\ 등록 모달을 닫고, 다시 업무 프로세스 목록의 추가 버튼을 클릭했을 때, 중요도 표시(별 아이콘)이 사라지지 않았음.\\ \\ form 초기화 함수도 작동을 하지 않았음.\\ \\ 해결방법\\ 업무 프로세스 추가 버튼 클릭 시 이벤트 정의부분에서, form 초기화 + 업무 프로세스 항목 자체를 삭제하고,\\ 다시 input을 추가하는 방식으로 해결함.\\ ===== Ref Link ===== [[https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reset|HTMLFormElement.reset()]]\\ [[https://www.w3schools.com/jsref/met_element_setattribute.asp|HTML DOM Element setAttribute()]]\\ {{tag>오션 HTMLFormElement.reset() reset()}}