---
title: "jquery 控制 append(content)"
author: "KAXU"
date: "2009-01-12T14:46:29Z"
tags: ["HTML", "jQuery"]
slug: "jquery-append-content"
draft: false
lastmod: "2009-01-12T14:47:57Z"
id: 315061
url: "https://kaxu.iteye.com/blog/315061"
---

append(content)

将新的内容'content'附加在每一个匹配元素集合的元素后。

```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    $("p").append("<strong>Hello</strong>");
  });
  </script>
  <style>p { background:yellow; }</style>
</head>
<body>
  <p>I would like to say: </p>
</body>
</html>
```

 

$("p").append("&lt;strong&gt;Hello&lt;/strong&gt;");  
将新的内容‘&lt;strong&gt;Hello&lt;/strong&gt;’附加到匹配的p元素内容之后。