$.fn.extend({
        "DIY":function(fn){}});我要实现以下效果$("li").DIY(function(){alert("");});怎样在自定义的函数中加入函数参数?

解决方案 »

  1.   

    $.fn.extend({
      "DIY":function(fn){//fn就是你的参数
        alert(fn);
      }
     }
    );$("li").DIY("你要弹出的内容");
      

  2.   

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <style>

    </style>
    </head>
    <body>

    <script>
    $.fn.extend({
    DIY: function(fn){
    fn()
    }
    });
    $().DIY(function(){
    alert(123)
    })
    </script>
    </body>
    </html>
    楼主 这个意思?