jQuery的jQuery属性简要介绍

2021年3月9日15:53:06 发表评论 619 次浏览

jQuery属性用于返回jQuery版本号。

语法

$().jquery

例子:返回版本号。

<!DOCTYPE html>
< html >
  
< head >
     < style >
         h1 {
             color: green;
         }
     </ style >
     < script src =
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" >
   </ script >
     
   < script >
         $(document).ready(function() {
            
             $("button").on(
               "click", function() {
                 var cu_version = $().jquery;
                  
                 alert("The running jQuery version is: "
                       + cu_version);
             });
         });
     </ script >
</ head >
  
< body >
     < center >
         < h1 >Geeks for Geeks</ h1 >
             < button >
               Check
       </ button >
     </ center >
</ body >
  
</ html >

输出如下:

之前:

jQuery | jQuery属性1

后:

jQuery | jQuery属性2

木子山

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: