首页 > 其他分享 >jquery中的load()方法

jquery中的load()方法

时间:2023-01-30 11:02:19浏览次数:28  
标签:jquery load function html file includeObj 方法

除了web框架中自带的工具外,jquery中使用load()防止前端代码重复
导航,底部标签可以放在base文件中
<div class="include" file="base.html"></div>

<script> $(".include").each(function() { if (!!$(this).attr("file")) { var $includeObj = $(this); $(this).load($(this).attr("file"), function(html) { $includeObj.after(html).remove(); }) } });
</script>
 

标签:jquery,load,function,html,file,includeObj,方法
From: https://www.cnblogs.com/wy401/p/17074825.html

相关文章