首页 > 代码库 > JS模拟jQuery

JS模拟jQuery

 1 <!doctype html> 2 <html lang="en"> 3 <head> 4     <meta charset="UTF-8"> 5     <title>Document</title> 6     <script type="text/javascript"> 7  8         (function(w){ 9             w.$ = function(){10                 alert("======");11             };12         })(window);13 14         $();//相当于window.$();15     </script>16 </head>17 <body>18     19 </body>20 </html>
View Code

 

JS模拟jQuery