使用Jquery/Javascript的Gwt原始Html内容?

使用Jquery/Javascript的Gwt原始Html内容?,java,javascript,jquery,html,Java,Javascript,Jquery,Html,我有下面的html页面 <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ alert($(

我有下面的html页面

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    alert($("#aaa").html());
  });
});
</script>
</head>
<body id="aaa">

<button>hello</button>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<input type="text" name="textt"/>

</body>
</html>
但是请注意输出。缺少输入的结束标记。如何在不丢失
input
的结束标记的情况下获得html的确切原始内容

我期望低于输出

<button>Change content of all p elements</button>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<input name="textt" type="text">
<button>Change content of all p elements</button>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<input name="textt" type="text"/>
更改所有p元素的内容
这是一段

这是另一段

谢谢

试试这个:

  $(document).ready(function(){
  $("button").click(function(){
    alert($("#aaa").html() +"</input>");
  });
});
$(文档).ready(函数(){
$(“按钮”)。单击(函数(){
警报($(“#aaa”).html()+”;
});
});

输入元素不需要结束标记。谢谢你的回答。我仍然需要一个结束标记,比如因为原始html是XML解析器的输入,否则XML解析器会抱怨输入没有结束标记。这就是我需要它的原因。有什么解决方案吗?