jQuery(3-4)插入节点
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>example.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript" src="../jquery-1.7.1.js"></script>
</head>
<body>
<h3>水果</h3>
<p title="选择你喜欢的水果"> 你喜欢的水果是?</p>
<p title="1234567"> 你喜欢的水果是?</p>
<ul>
<li>苹果</li>
<li>橘子</li>
<li>菠萝</li>
<li>香蕉</li>
<li>梨子</li>
</ul>
</body>
<script type="text/javascript">
/*
$('p').append('你好 ');
//向每个匹配的元素后面追加 类容
/*
$('<b>你好</b>').appendTo('li');
//一定要加标签 不可以直接打字 <b>你好</b> 添加到指定标签的后面
//常规颠倒 将所有匹配的元素 追加到 指定的元素 中
*/
/*
$('li').prepend("<b> 你好 </b>");
//向每个匹配的元素内 设置类容
*/
/*
$('<b> 你好 </b>').prependTo("li");
//添加到指定标签的前面
//常规颠倒 将所有匹配的元素前置到 指定的元素 中 (将类容放在标签前面去了 )
*/
/*
$('li').after('<b>123</b>');
//在某个元素 之后添加内容 就是换行 添加
*/
/*
$('<b>123</b>').insertAfter('li');
//常规颠倒
$('p').before('哦哦 '); //元素 之前 写东西
/*
$('<br>你好</br> ').insertBefore('li');
//匹配的元素 添加在 指定的 元素之前
});
</script>
</html>