如何使用JQuery检索完整的DOM结构,其中输入只是一个按钮

How to retrieve the full DOM structure using JQuery where input is only a button?

本文关键字:输入 按钮 一个 检索 JQuery 何使用 结构 DOM      更新时间:2023-10-14

当只有一个按钮元素(显然是DOM的一部分)可用时,我正试图检索完整的DOM结构?

$(this) = <button class="btn" id="addBtn" data-toggle="modal" data-target="#addModal"><span class="add"></span> Add...</button> 

感谢

$("html").bind("DOMSubtreeModified", function()
   {
      // when a change is made in the DOM, this gets fired
      if($('#idOfYOurElement')!==undefined)
      {
        var oEntireDom = $('html').html(); // if you want the content in html
   });
$("html").html();

将为您提供完整的DOM