(function($) { $.fn.extend({ bold: function() { this.css({ fontWeight: "bold", color: 'red' }) } }); })(jQuery);
简单写一个字体颜色加粗 颜色为红色。
DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>title>
<div class="asd">1div>
head>
<body>
<script src="static/js/jquery.min.js" type="text/javascript" charset="utf-8">script>
<script src="组件的.js" type="text/javascript" charset="utf-8">script>
<script type="text/javascript">
$(function() {
$(".asd").bold();
});
script>
body>
html>