Since I want to display the current time in several places after the page is loaded, I need to assign values to multiple spans.
The span code is written as follows:
(multiple spans)
jQuery writing:
<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>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn