开发者

DOM Elements accessibility in ASP.NET MVC and ASCX

开发者 https://www.devze.com 2023-03-30 05:33 出处:网络
I have a complex asp.net mvc view where I load an \"ascx\" partial view into a div using $.ajax(). So I was wondering about the accessibility of the DOM elements contained in the main page and the asc

I have a complex asp.net mvc view where I load an "ascx" partial view into a div using $.ajax(). So I was wondering about the accessibility of the DOM elements contained in the main page and the ascx partial view. Using jQuery selectors, can I find an element in the main page from the ascx partial view? 开发者_如何学Pythonand the other way round?


Both ways, depending on the point on time.

You can always access the elements from the main view, since the HTML is bound at render-time (e.g $(document).ready())

You won't be access the elements in the partial view from the parent view until the callback from the $.ajax method has completed successfully and you have binded the HTML to the DOM (with .html(result) for example).

0

精彩评论

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