内容选择器
来源:互联网 发布:管家婆的映射端口 编辑:程序博客网 时间:2024/05/18 03:41
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
img
{
width:200px; height:200px;
}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btn').click(function () {
//alert($('div:eq(0)').text()); //获取的是标签之间的文本
//alert($('div:eq(0)').html()); //获取的是标签之间的内容,无论是html标签还是文本
//$('div:eq(1)').html($('div:eq(0)').text())//输出文本无格式
//$('div:eq(1)').html($('div:eq(0)').html());//输出文本带有格式
//$('div:eq(1)').text($('div:eq(0)').html());//输出的是标签之间的内容包括标签
//$('div:eq(1)').text($('div:eq(0)').text());//输出标签之间的内容不包括标签
alert($('img').html());
})
})
</script>
</head>
<body>
<p title="dd">第一段</p>
<a href="#">dadaffd</a>
<img src="images/1.jpg" />图片
<div>
<b><i>白日依山尽<br/>
黄河入海流<br/>
欲穷千里目<br/>
更上一层楼</i></b>
</div>
<div>
</div>
<div>
</div>
<input type="button" id="btn" value="获取设置内容" />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
img
{
width:200px; height:200px;
}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btn').click(function () {
//alert($('div:eq(0)').text()); //获取的是标签之间的文本
//alert($('div:eq(0)').html()); //获取的是标签之间的内容,无论是html标签还是文本
//$('div:eq(1)').html($('div:eq(0)').text())//输出文本无格式
//$('div:eq(1)').html($('div:eq(0)').html());//输出文本带有格式
//$('div:eq(1)').text($('div:eq(0)').html());//输出的是标签之间的内容包括标签
//$('div:eq(1)').text($('div:eq(0)').text());//输出标签之间的内容不包括标签
alert($('img').html());
})
})
</script>
</head>
<body>
<p title="dd">第一段</p>
<a href="#">dadaffd</a>
<img src="images/1.jpg" />图片
<div>
<b><i>白日依山尽<br/>
黄河入海流<br/>
欲穷千里目<br/>
更上一层楼</i></b>
</div>
<div>
</div>
<div>
</div>
<input type="button" id="btn" value="获取设置内容" />
</body>
</html>
- 内容选择器
- 选择器 内容
- JQuery选择器(内容过滤选择器)
- jQuery选择器-内容选择器示例
- jquery选择器之内容选择器
- jquery内容选择器
- jQuery内容过滤选择器
- jQuery内容过滤选择器
- 内容过滤选择器
- jquery内容过滤选择器
- jquery内容过滤选择器
- jQuery 内容过滤选择器
- jQuery内容过滤选择器
- 内容过滤选择器
- 内容过滤选择器
- 内容过滤选择器
- JQuery 内容过滤选择器
- 内容生成选择器
- 预安装apk的方法(RK方案)
- Bootstrap 集成富文本编辑框(tinyeditor)
- Android中Service类onStartCommand
- android基础知识02——线程安全1:定义及例子
- DBA工作指南
- 内容选择器
- 不用库函数,用C语言实现将一整型数字转化为字符串
- cocos2d-x2.0.2以后代码差异
- 《C#入门到精通》学习笔记 -- 实践: 自定义异常类的实现(2013-04-18)
- android基础知识02——线程安全2:handler、message、runnable
- 进程通信系列-单向邮槽
- Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'
- poj1010
- 在Release版本中输出打印信息,实现TRACE功能