我在 html 中有这样的东西:
<div class ="personal-datas">Datas</div>
<h2 class ="name">Jack Bauer</h2>
<div class ="date-of-birth">february the 9th 1984</div>
<h3 class ="company">Jane Ventures</h3>
<h5 class ="status">married</h5>
<p class ="country">Canada</p>
<div class ="personal-datas">Datas</div>
<h2 class ="name">Clarice Sterling</h2>
<div class ="date-of-birth">3rd of March 1981</div>
<h3 class ="company">FBI</h3>
<h3 class ="chasing">Buffalo Bill</h3>
<h3 class ="skill">Profiler</h3>
<h5 class ="status">Bachelor</h5>
<p class ="country">USA</p>
<div class ="personal-datas">Datas</div>
我想选择并在 JSON 文件中存储带有“个人数据”类的两个标签之间的所有内容,如下所示:
{
"personal-datas1":
{
"name": "jack bauer",
"date-of-birth": "february the 9th 1984",
"company": "Jane Ventures",
"status": "married",
"country": "Canada"
},
"personal-datas2":
{
"name": "Clarice Sterling",
"date-of-birth": "3rd of March 1981",
"company": "FBI",
"chasing": "Buffalo Bill",
"skill": "Profiler",
"status": "Bachelor",
"country": "USA"
}
}
我如何继续使用普通 JS 或 Jquery?感谢您的答复。
婷婷同学_
海绵宝宝撒
湖上湖
12345678_0001
相关分类