2011-08-25 2 views
2

숨겨진/보이지 않는 요소에서 Microsoft AJAX jscript $ find가 작동하지 않습니까? 작동하지 않는 것 같지만 예상 된 동작인지 여부를 알 수 없습니다. asp.net은 false로 설정 Visible 속성을 사용하여 컨트롤의 HTML을 생성하지 않기 때문에 당신이 false에 컨트롤의 Visible 속성을 설정 한 경우

+1

은 왜 그냥 보이지 않는 요소와 함께 작동합니다 document.getElementById를 ("foo는")를 사용할 수 있습니까? – jfriend00

+0

나는 jfriend00에 동의한다; getElementById 메소드의 단축키로 $ get을 사용할 수 있습니다. – Romhein

+0

$ get, $ find, document.getElementById ("foo") 모든 CSS 요소가 적용됩니다 (display : none, visibility : hidden ..). .기타). –

답변

4

, 다음 $find는, 아무것도 찾을 수 없습니다. 하지만 css/javascript를 사용하여 컨트롤을 숨기는 경우 작동해야합니다.

+0

+1 내가 이것을 깨달을 때까지 –

0

DOM에 긍정적 인 요소가 있습니까 (예 : Visible = True)? 여기에 몇 가지 reference info 예상 동작과 같다 :

$find 실제로 findComponent를 호출

Sys.Application = new Sys._Application(); 
window.$find = Sys.Application.findComponent; 

findComponent: function _Application$findComponent(id, parent) { 
     /// <summary locid="M:J#Sys.Application.findComponent">Finds top-level components that were added through addComponent if no parent is specified or children of the specified parent. If parent is a component</summary> 
     /// <param name="id" type="String">The id of the component to find.</param> 
     /// <param name="parent" optional="true" mayBeNull="true">The component or element that contains the component to find. If not specified or null, the search is made on Application.</param> 
     /// <returns type="Sys.Component" mayBeNull="true">The component, or null if it wasn't found.</returns> 
     //#if DEBUG 
     var e = Function._validateParams(arguments, [ 
      {name: "id", type: String}, 
      {name: "parent", mayBeNull: true, optional: true} 
     ]); 
     if (e) throw e; 
     //#endif 
     // Need to reference the application singleton directly beause the $find alias 
     // points to the instance function without context. The 'this' pointer won't work here. 
     return (parent ? 
      ((Sys.IContainer.isInstanceOfType(parent)) ? 
       parent.findComponent(id) : 
       parent[id] || null) : 
      Sys.Application._components[id] || null); 
    }, 
관련 문제