天天看點

動态擷取html頁面的内容,并且取其中的某塊元素的方法

$.ajax({

  async:false,

  type:'post',

  datatype:'html',

  success:function(data) {

      console.log("-------------------------------------------------");

      var htmltexttext = $('div').html(data);

      console.log($('div').html(data).eq(1).find("#workspace-body"));

      $('div').html(data).eq(1).find("link,script,style").each(function(index,domele){

       //$("head").append($(domele));

       console.log(domele);

      });

   //自動為布局檔案的html中加上id

     }

  });