search

Home  >  Q&A  >  body text

Dynamically generate span based on li

Dynamically generate span tags based on the number of li tags, and clicking the span tag will also display the corresponding li content

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="css/ 3.css">
</head>
<body>
<ul id="box">
<li>item0</li>
< ;li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<div id="spans ">

</div>
</body>
<script src="js/js3.js"></script>
</ html>

白一白一2111 days ago1065

reply all(2)I'll reply

  • 秋香姐家的小书童

    秋香姐家的小书童2019-03-26 09:37:47

    Are you asking a question or taking notes?

    reply
    0
  • Cancelreply