Microsoft AJAX jscript $發現不能在隱藏/不可見元素上工作嗎? 我似乎無法得到它的工作,但我不知道這是否是預期的行爲。
2
A
回答
4
如果你設置了一個控制false
的Visible
屬性,那麼$find
不會找到任何東西,因爲asp.net不會產生與Visible
屬性設置爲false
控件的HTML。但它應該工作,如果您使用CSS/JavaScript隱藏控制。
+0
+1剛剛瘋了,直到我意識到這一點 –
0
你是積極的元素是在DOM(即:可見= 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);
},
相關問題
- 1. 元素克隆隱藏/顯示不適用於克隆元素
- 2. JQuery發現不適用於tr元素?
- 3. JQuery將隱藏元素檢測爲可見和可見元素隱藏
- 4. ASP使不可見元素可見
- 5. 元素被隱藏並且不可點擊(但其可見)
- 6. 如何隱藏元素,如果另一個元素不存在或不可見?
- 7. 由於隱藏div,按鈕不可見
- 8. 此顯示/隱藏功能不適用於MultiSelect元素
- 9. 點擊隱藏可見元素D3.js
- 10. 使元素可見並隱藏點擊
- 11. 自動隱藏可見子元素
- 12. 用AJAX顯示/隱藏JSF元素後如何隱藏觸發元素?
- 13. Silverlight:如何從元素在隱藏之前不可見開始?
- 14. jquery選項卡中的隱藏元素不可見
- 15. jQuery如何不斷檢查元素是隱藏/可見的?
- 16. 輸入字段值與隱藏可見性隱藏不發佈
- 17. 元素不是隱藏
- 18. js不適用於Rails中出現的ajax元素
- 19. 元素不可見
- 20. 元素不可見
- 21. 計算jQuery文本()。可見元素的長度而不刪除隱藏元素
- 22. 隱藏ajax注入元素而不觸及ajax調用本身
- 23. 硒發現隱藏的元素
- 24. 元素不會隱藏
- 25. slideDown不會「隱藏」元素
- 26. 元素隱藏,但父()不
- 27. onLoad不適用於元素
- 28. jQuery.css()不適用於元素
- 29. CSS不適用於元素
- 30. 填充不適用於容器元素內的元素嗎?
爲什麼不直接使用的document.getElementById(「富」),這將不可見元素的工作? – jfriend00
我同意jfriend00;您可以使用$ get作爲getElementById方法的快捷方式 – Romhein
$ get,$ find,document.getElementById(「foo」)在DOM中查找所有元素,而不管應用了什麼CSS(display:none; visibility:hidden .. 。等等)。 –