[英]jQuery event to catch loaded content
I have aspx page with form which fire result to div on the same page. 我有形式的aspx页面,其结果导致在同一页面上的div。 I need to process hrefs inside result output. 我需要在结果输出中处理hrefs。 Which action should be used in this case? 在这种情况下应该使用哪个动作? $(document).ready
and $(document).ajaxComplete
didn't work. $(document).ready
和$(document).ajaxComplete
无效。 Concerning ajaxComplete
as I understand it is because not a jQuery routine is used by page controls. ajaxComplete
我了解,关于ajaxComplete
原因是页面控件未使用jQuery例程。
<script type="text/javascript" language="javascript">
$(document).ajaxComplete(function() {
$('a[href*="mouz"]').removeAttr('href');
});
</script>
<script type="text/javascript" language="javascript">
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
});
</script>
Here is the answer, adapted from MSDN - http://msdn.microsoft.com/en-us/library/bb397523(v=vs.100).aspx 这是从MSDN改编的答案-http: //msdn.microsoft.com/zh-cn/library/bb397523 (v=vs.100) .aspx
In your client script add the following 在您的客户端脚本中添加以下内容
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
to handle the event, 处理事件,
function pageLoaded(sender, args) {
//get all of the panels which have been updated
var updatedPanels = args.get_panelsUpdated();
//perform the removal of the href attr on the DOM element collection
$(updatedPanels).find('a[href*="mouz"]').removeAttr('href');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.