久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      jquery中this代表什么意思

      jquery中this代表“當(dāng)前對象”的意思,this表示的是html中的當(dāng)前元素,利用“$(this)”語句把html元素變成jquery對象,進(jìn)而使用jquery方法來處理當(dāng)前對象,語法為“$(this).jquery方法名();”。

      jquery中this代表什么意思

      本教程操作環(huán)境:windows10系統(tǒng)、jquery3.2.1版本、Dell G3電腦。

      jquery中this代表什么意思

      this 是dom對象,說白了就是html里那些標(biāo)簽,$(this)是把dom對象改成JQuery對象,這樣隨后就能用JQuery的方法處理Dom對象了。

      首先來看看JQuery中的 $() 這個符號,實(shí)際上這個符號在JQuery中相當(dāng)于JQuery(),即$(this)=jquery();也就是說,這樣可以返回一個jquery對象。那么,當(dāng)你在網(wǎng)頁中alert($('#id'));時,會彈出一個[object Object ],這個object對象,也就是jquery對象了。

      示例如下:

      <html> <head> <meta charset="utf-8"> <title>123</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){   $("p").click(function(){     $(this).hide();//$(this)是在方法click內(nèi),此處的$(this)表示的是當(dāng)前調(diào)用click方法的對象$("p"),就是表示當(dāng)前對象,當(dāng)前調(diào)用該方法的對象   }); }); </script> </head> <body> <p>如果您點(diǎn)擊我,我會消失。</p> <p>點(diǎn)擊我,我會消失。</p> <p>也要點(diǎn)擊我哦。</p> </body> </html>

      輸出結(jié)果:

      jquery中this代表什么意思

      相關(guān)視頻教程推薦:jQuery視頻教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號