Sys.UI.DomElement $get 메서드
업데이트: 2007년 11월
Sys.UI.DomElement 클래스의 getElementById 메서드에 대한 바로 가기를 제공합니다. 이 멤버는 정적 멤버이며 클래스의 인스턴스를 만들지 않고 호출할 수 있습니다.
$get(id, element);
매개 변수
값 |
정의 |
---|---|
id |
찾을 DOM 요소의 ID입니다. |
element |
검색할 부모 요소이며 기본값은 document 요소입니다. |
예제
다음 예제에서는 $get 메서드를 사용하는 방법을 보여 줍니다. 이 코드는 DomElement 클래스 개요에 포함된 예제의 일부입니다.
// Add handler using the getElementById method
$addHandler(Sys.UI.DomElement.getElementById("Button1"), "click", toggleCssClassMethod);
// Add handler using the shortcut to the getElementById method
$addHandler($get("Button2"), "click", removeCssClassMethod);
// Add handler using the getElementById method
$addHandler(Sys.UI.DomElement.getElementById("Button1"), "click", toggleCssClassMethod);
// Add handler using the shortcut to the getElementById method
$addHandler($get("Button2"), "click", removeCssClassMethod);