这是我<div>
的 id = CarSpecs。我想用 jQuery 的选择器重用这段代码。我想要实现的是使用诸如这样的东西,$("CarSpecs")
所以我不会有一个巨大的 HTML 文件。
有人可以告诉我如何做到这一点吗?
<div id="CarSpecs">
<div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
<h1>Price</h1>
</div>
<div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
<h1>Body</h1>
</div>
<div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
<h1>Transmission</h1>
</div>
<div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
<h1>Engine</h1>
</div>
<div data-role="collapsible" data-theme="a" data-content-theme="a" data-collapsed-icon="arrow-d" data-expanded-icon="arrow-u">
<h1>Fuel</h1>
</div>
</div>