jQuery 价格显示 前面位数与后面两位显示不同样式(一大一小)

Posted 青青子衿。

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jQuery 价格显示 前面位数与后面两位显示不同样式(一大一小)相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>价格显示</title>
	<script src="scripts/jquery-1.7.1.min.js"></script>
</head>
<body>
<script type="text/javascript"> 
$(function(){
// 价格显示
    $(".index_price").each(function(){
        $(this).html(\'<span class="big_price">\' + $(this).html().split(\'.\').join(\'.</span><span class="small_price">\')  + \'</span>\');
    });
})
</script> 
<span>¥</span><span class="index_price">987.88</span>
<style>
.big_price {font-size:20px;}
.small_price {font-size:14px;}
</style>
</body>
</html>

  

 

以上是关于jQuery 价格显示 前面位数与后面两位显示不同样式(一大一小)的主要内容,如果未能解决你的问题,请参考以下文章