jQuery获取自身HTML

<html>
<head>
<title>jQuery获取自身HTML</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<script type="text/javascript" src="http://files.cnblogs.com/Zjmainstay/jquery-1.6.2.min.js"></script>
</head>
<body>
<div class="aa" style="border:1px solid #ABC;width:200px;text-align:center;">点击获取我自身的HTML吧</div>
<script type="text/javascript">
$(document).ready(function(){
$(".aa").click(function(){alert($("<p>").append($(this).clone()).html())});
});
</script>
</body>
</html>

时间: 2024-08-27 19:20:19

jQuery获取自身HTML的相关文章

JQuery获取input type=&quot;text&quot;中的值的各种方式

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>JQuery获取文本框的值</title> <meta http-equ

Javascript/jQuery 获取地址栏URL参数的方法

1.jquery获取url很简单,代码如下 window.location.href; 2.javascript获取url参数 function getUrlParam(name) { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg);  /

jQuery获取Select选择的Text(非表单元素)和 Value(表单元素)(转)

jQuery获取Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 2. var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text 3. var checkValue=$("#selec

jQuery获取Select选择的Text和 Value

jQuery获取Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code...});   //为Select添加事件,当选择其中一项时触发 2. var checkText=$("#select_id").find("option:selected").text();  //获取Select选择的Text 3. var checkValue=$("#se

使用jquery获取radio的值

使用jquery获取radio的值,最重要的是掌握jquery选择器的使用,在一个表单中我们通常是要获取被选中的那个radio项的值,所以要加checked来筛选,比如有以下的一些radio项: 1.<input type="radio" name="testradio" value="jquery获取radio的值" />jquery获取radio的值<br /> 2.<input type="radio

Jquery获取select选中的option的文本信息

注意:下面用的$(this)代表当前选中的select框 第一种: $(this).children("option:selected").text(); 第二种: $(this).children("option:selected").html(); Jquery获取select选中的option的文本信息,布布扣,bubuko.com

使用jquery获取父元素或父节点的方法

jquery获取父元素方法比较多,比如parent(),parents(),closest()这些都能帮你实现查找父元素或节点,下面我们来一一讲解: <ul class="parent1"> <li><a href="#" id="item1">jquery获取父节点</a></li> <li><a href="#">jquery获取父元素&l

jquery获取checkbox被选中的值

只用一个循环,就可以找出被选中的checkbox的值 var s; $("[name = b]:checkbox").each(function () {                   if (this.checked) {                       s += $(this).val() + "|";                   }               });alert(s); 这样就可以了 jquery获取checkbox被

jQuery -&gt; 获取孩子节点

jQuery提供了很多方法来获取一个元素的direct descendant(直接后代). 最简单的方式是使用direct descendant combinator (>) 例如,如果要获取如下html代码中<div id="content">的直接孩子节点中的a元素,就可以直接使用 > 符号 <body> <div id="content"> <a href="http://www.jquery.c

js,jquery获取下拉框选中的option

js获取select选中的值: var sel=document.getElementById("select1"); var index = sel.selectedIndex; // 选中索引 albumid= sel.options[index].value;//要的值 jQuery获取下拉框选中的option: $("#s option:selected").val();