开发者

Does Microsoft AJAX jscript $find not work on hidden / non-visible elements?

Does Microsoft AJ开发者_如何学JAVAAX jscript $find not work on hidden / non-visible elements? I can't seem to get it work but I don't know if this is expected behavior.


If you have set the Visible property of a control to false, then $find will not find anything, because asp.net doesn't generate html for the controls with Visible property set to false. But it should work if your using css/javascript to hide control.


Are you positive the element is in the DOM(ie:Visible=True)? Here is some reference info as to expected behavior:

$find actually calls 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);
    },
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜