<div id="div1">test</div>
var htmlElement = $("div1").prop("outerHTML");// 获得指定元素包括本身
结果:htmlElement = <div id="div1">test</div>