实例 jQuery 演示返回元素的内容。

x
 
<!DOCTYPE html>
<html>
<head>
<script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    alert($("p").html());
  });
});
</script>
</head>
<body>
<button>Return the content of the p element</button>
<p>This is a <b>paragraph</b>.</p>
</body>
</html>
                    

输出结果