由于我想在页面加载完成后,有几个地方显示当前时间,所以我需要给多个span赋值。
span代码的写法如下:
(多个span)
jQuery写法:
jQuery 1.12.4是jQuery 1.x系列的最后一个正式稳定版本,由jQuery团队于2016年发布。该版本主要面向需要兼容旧版浏览器环境的网站和Web应用,尤其适用于仍需支持Internet Explorer 6、Internet Explorer 7、Internet Explorer 8等老旧浏览器的项目。
<script> <BR>$(document).ready(function() { <BR>var currentDate = new Date().toLocaleDateString(); <BR>$("span[name='currentDate']").each(function() { <BR>$(this).text(currentDate); <BR>}); <BR>}); <BR></script>










