jquery中的load()方法

除了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>
 
posted @ 2023-01-30 10:51  enzo_ferrari  阅读(123)  评论(0)    收藏  举报