본문 바로가기

Open API/Jquery

jQuery 객체 초기화



Jquery에서 $('#폼').reset()  스크립트로는 초기화가 되지 않습니다..


지정객체 또는 반복문을 이용해서 초기화를 해야합니다.



폼 전체 초기화

$("form[name='폼네임']").each(function(){ 
    this.reset();
});

특정 객체 초기화

// 타입 : input , text , button 등..
$("form[name='폼네임']").find('타입').each(function() {       
   $(this).val("");
});