<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # jQuery 語法 **通過 jQuery,您可以選取(查詢,query) HTML 元素,并對它們執行“操作”(actions)。** ## jQuery 語法實例 [$(this).hide()](/tiy/t.asp?f=jquery_hide_this) 演示 jQuery hide() 函數,隱藏當前的 HTML 元素。 ``` <html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $(this).hide(); }); }); </script> </head> <body> <button type="button">Click me</button> </body> </html> ``` [$("#test").hide()](/tiy/t.asp?f=jquery_hide_id) 演示 jQuery hide() 函數,隱藏 id="test" 的元素。 ``` <html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("#test").hide(); }); }); </script> </head> <body> <h2>This is a heading</h2> <p>This is a paragraph.</p> <p id="test">This is another paragraph.</p> <button type="button">Click me</button> </body> </html> ``` [$("p").hide()](/tiy/t.asp?f=jquery_hide_p) 演示 jQuery hide() 函數,隱藏所有 <p> 元素。 ``` <html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("p").hide(); }); }); </script> </head> <body> <h2>This is a heading</h2> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button type="button">Click me</button> </body> </html> ``` [$(".test").hide()](/tiy/t.asp?f=jquery_hide_class) 演示 jQuery hide() 函數,隱藏所有 class="test" 的元素。 ``` <html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $("button").click(function() { $(".test").hide(); }); }); </script> </head> <body> <h2 class="test">This is a heading</h2> <p class="test">This is a paragraph.</p> <p>This is another paragraph.</p> <button type="button">Click me</button> </body> </html> ``` ## jQuery 語法 jQuery 語法是為 HTML 元素的選取編制的,可以對元素執行某些操作。 基礎語法是:_$(selector).action()_ * 美元符號定義 jQuery * 選擇符(selector)“查詢”和“查找” HTML 元素 * jQuery 的 action() 執行對元素的操作 ### 示例 $(this).hide() - 隱藏當前元素 $("p").hide() - 隱藏所有段落 $(".test").hide() - 隱藏所有 class="test" 的所有元素 $("#test").hide() - 隱藏所有 id="test" 的元素 提示:jQuery 使用的語法是 XPath 與 CSS 選擇器語法的組合。在本教程接下來的章節,您將學習到更多有關選擇器的語法。 ## 文檔就緒函數 您也許已經注意到在我們的實例中的所有 jQuery 函數位于一個 document ready 函數中: ``` $(document).ready(function(){ --- jQuery functions go here ---- }); ``` 這是為了防止文檔在完全加載(就緒)之前運行 jQuery 代碼。 如果在文檔沒有完全加載之前就運行函數,操作可能失敗。下面是兩個具體的例子: * 試圖隱藏一個不存在的元素 * 獲得未完全加載的圖像的大小
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看