您好,欢迎访问一九零五行业门户网

jquery中each方法示例和常用选择器

这篇文章主要介绍了jquery中each方法使用及常用选择器都有哪些,需要的朋友,可以参考下
<head> <title></title> <script src="jquery-1.4.2.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { //alert($("p").text()); //对数组元素使用匿名函数进行逐个处理。 $("p").each(function(key, value) { //alert(key+value); // alert($(value).text()); alert(this.innerhtml); }); //this表示当前遍历的dom元素 $("p").each(function() { alert($(this).text()); }); }); </script> </head> <body> <p id="testdom">11111</p> <p>2222</p> <p>33333</p> </body>
常用选择器:
1.类:$(.error).
2.id:$(#dalong).
3.标签:$(p).
4.属性:$(p[name=apple]).
5.表单:$(input:checked).
以上就是jquery中each方法示例和常用选择器的详细内容。
其它类似信息

推荐信息