如何在不添加更多标签的情况下获得有序数字粗体?
在jQuery中可能吗?
1.第一元素
2. secondelement
3. thirdelement
最好的问候
hakan
假设您的样本列表是一个ol列表,以下将执行此操作.
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" />
<script type="text/javascript">
$(document).ready(function () {
$("ol li").each(function (index) {
$(this).wrapInner("<span />");
});
$("ol").css("font-weight", "bold");
$("ol li span").css("font-weight", "normal");
}
);
</script>
</head>
<body>
<ol>
<li>first element</li>
<li>secondelement</li>
<li>thirdelement</li>
</ol>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)