久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='2kNsC'><tr id='2kNsC'><dt id='2kNsC'><q id='2kNsC'><span id='2kNsC'><b id='2kNsC'><form id='2kNsC'><ins id='2kNsC'></ins><ul id='2kNsC'></ul><sub id='2kNsC'></sub></form><legend id='2kNsC'></legend><bdo id='2kNsC'><pre id='2kNsC'><center id='2kNsC'></center></pre></bdo></b><th id='2kNsC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2kNsC'><tfoot id='2kNsC'></tfoot><dl id='2kNsC'><fieldset id='2kNsC'></fieldset></dl></div>
    <legend id='2kNsC'><style id='2kNsC'><dir id='2kNsC'><q id='2kNsC'></q></dir></style></legend>
    1. <small id='2kNsC'></small><noframes id='2kNsC'>

        <bdo id='2kNsC'></bdo><ul id='2kNsC'></ul>
      <tfoot id='2kNsC'></tfoot>

      1. jQuery .on() 方法看不到新元素

        jQuery .on() method doesn#39;t see new elements(jQuery .on() 方法看不到新元素)
      2. <tfoot id='WFWZT'></tfoot>

        • <bdo id='WFWZT'></bdo><ul id='WFWZT'></ul>

            <legend id='WFWZT'><style id='WFWZT'><dir id='WFWZT'><q id='WFWZT'></q></dir></style></legend>
            • <i id='WFWZT'><tr id='WFWZT'><dt id='WFWZT'><q id='WFWZT'><span id='WFWZT'><b id='WFWZT'><form id='WFWZT'><ins id='WFWZT'></ins><ul id='WFWZT'></ul><sub id='WFWZT'></sub></form><legend id='WFWZT'></legend><bdo id='WFWZT'><pre id='WFWZT'><center id='WFWZT'></center></pre></bdo></b><th id='WFWZT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WFWZT'><tfoot id='WFWZT'></tfoot><dl id='WFWZT'><fieldset id='WFWZT'></fieldset></dl></div>

                • <small id='WFWZT'></small><noframes id='WFWZT'>

                    <tbody id='WFWZT'></tbody>
                  本文介紹了jQuery .on() 方法看不到新元素的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在獲取一個 JSON 元素并從它的項目中構建一個列表,如下所示:

                  I'm getting a JSON element and building a list from its items like this:

                  getTitles: function(data) {
                      data = data || {};
                      var list = [];
                  
                      $.getJSON(
                          '/titles',
                          data,
                          function(data) {
                              $.each(data.data, function(key, val) {
                                  list.push(
                                      '<li><a href="'+ val.href +'">'+ val.title +'</a><span class="count">'+ val.count +'</span></li>'
                                  )
                              });
                  
                              $('#title-items').html(list.join(''));
                          }
                      );
                  }
                  

                  我正在為 a 元素綁定點擊事件,如下所示:

                  And I'm binding click event for a elements like this:

                  $('a').on('click', function(e) {
                      alert('clicked');
                      e.preventDefault();
                  });
                  

                  舊的 a 元素顯示警報,但新元素跟隨 URL.事件處理程序不適用于新的.我該如何解決這個問題?

                  Old a elements shows alert but new ones follow URL. Event handler doesn't work for new ones. How can I solve this?

                  推薦答案

                  您沒有使用正確的代碼來獲得 live 功能.

                  You are not using the correct code to get live functionality.

                  $('#title-items').on('click', 'a', function(e) {
                      alert('clicked');
                      e.preventDefault();
                  });
                  

                  1. 首先,選擇您的共同祖先元素(本例中為 #title-items).如果你想處理 all a 元素,你也可以在這里使用 document.
                  2. 傳遞事件類型(on),然后子選擇器(a),然后是事件的回調函數.
                  1. First, select your common ancestor element (#title-items in this example). You can use document here too if you want to handle all a elements.
                  2. Pass the event type (on), then the sub selector (a), and then the callback function for the event.

                  現在,當 click 事件冒泡到 #title-items 時,它會檢查元素是否是 a 元素,如果是,則觸發回調.

                  Now, when click events bubble up to #title-items, it will check to see if the element is an a element, and if so, fire the callback.

                  這篇關于jQuery .on() 方法看不到新元素的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)
                    <bdo id='gc9xo'></bdo><ul id='gc9xo'></ul>
                    <legend id='gc9xo'><style id='gc9xo'><dir id='gc9xo'><q id='gc9xo'></q></dir></style></legend><tfoot id='gc9xo'></tfoot>

                        <tbody id='gc9xo'></tbody>

                    • <small id='gc9xo'></small><noframes id='gc9xo'>

                            <i id='gc9xo'><tr id='gc9xo'><dt id='gc9xo'><q id='gc9xo'><span id='gc9xo'><b id='gc9xo'><form id='gc9xo'><ins id='gc9xo'></ins><ul id='gc9xo'></ul><sub id='gc9xo'></sub></form><legend id='gc9xo'></legend><bdo id='gc9xo'><pre id='gc9xo'><center id='gc9xo'></center></pre></bdo></b><th id='gc9xo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gc9xo'><tfoot id='gc9xo'></tfoot><dl id='gc9xo'><fieldset id='gc9xo'></fieldset></dl></div>
                            主站蜘蛛池模板: 三级av在线 | 毛片一区二区三区 | 免费精品国产 | 在线观看国产wwwa级羞羞视频 | 国产一区二区三区免费视频 | 狠狠av | 国产中文| 国产精品成人品 | 亚洲福利在线观看 | 狠狠天天 | 亚洲国产一区二区三区 | 成年无码av片在线 | 亚洲欧美日韩成人在线 | 精品伊人久久 | 视频一区二区中文字幕 | 天天干国产 | www在线视频 | 国产一区二区三区在线 | 亚洲36d大奶网 | 亚洲精品福利视频 | 欧美极品在线播放 | 国产一区二区三区四区五区加勒比 | 久久久久网站 | 99精品视频在线 | 波多野结衣一区二区 | 伊人亚洲| 日韩精品一区二区三区第95 | 中文字幕在线一 | 日韩欧美在线精品 | 国产精品成人av | 天堂一区在线 | 成人精品国产免费网站 | 午夜精品久久久久久久星辰影院 | 视频在线一区 | 欧美日产国产成人免费图片 | 国产精品激情在线 | 成人免费网站www网站高清 | 黄色在线播放视频 | 日韩精品久久 | 精品福利视频一区二区三区 | 黄色三级免费网站 |