DOM Elements accessibility in ASP.NET MVC and ASCX
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).
精彩评论