jQuery扩展

有时候需要在jQuery基础上做属于自己的功能

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="js/jquery.min.js"></script>
    <script src="js/myquery.js"></script>
    <script src="js/demo.js"></script>
</head>
<body>
    <div></div>
</body>
</html>
myquery.js 扩展文件
// $.myjq=function(){
//     alert("myjQuery");
// }
$.fn.myjq=function(){
    $(this).text("hello");
}

demo.js 

$(document).ready(function(){
    //$.myjq();
    $("div").myjq();
})

 

posted @ 2015-10-12 17:41  tinyphp  Views(230)  Comments(0Edit  收藏  举报