Get selected element's outer HTML

前端 未结 30 2367
礼貌的吻别
礼貌的吻别 2020-11-21 04:50

I\'m trying to get the HTML of a selected object with jQuery. I am aware of the .html() function; the issue is that I need the HTML including the selected obje

30条回答
  •  天涯浪人
    2020-11-21 05:04

    If the scenario is appending a new row dynamically, you can use this:

    var row = $(".myRow").last().clone();
    $(".myRow").last().after(row);
    

    .myrow is the classname of the . It makes a copy of the last row and inserts that as a new last row. This also works in IE7, while the [0].outerHTML method does not allow assignments in ie7

提交回复
热议问题