jq封装插件,简单dome

(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>

 

转载于:https://www.cnblogs.com/chen527/p/10594307.html

你可能感兴趣的:(jq封装插件,简单dome)