Juqery 总结

1.读取带空格的控件:                                                                                 $(".container.layer").html();

2.读取div文本内容:                                                                                     $(".container.layer").html();

3.读取span文本内容:                                                                                $("#myspan").text();

4.读取text文本内容:                                                                                   $("#mytext").val();

5.读取dd文本内容:                                                                                      $("#mydd").html();

6.获取input类型为checkbox的控件:                                               $("input[type='checkbox']");

7. 获取input控件name不为hyipinvesthyip的值:                    $("input[name^='hyipinvesthyip']").val();

8.查询name以hyip结束的控件个数:                                               $("input[name$='hyip']").length;

9.查询name以hyip开头的控件个数:                                               $("input[name^='hyip']").length;

10.查询name包含oo的控件个数:                                                        $("input[name*='oo']").length;

11.查询name等于hyipinvest的控件的值:                                    $("input[name='hyipinvest']").val();

12.查询name不等于hyipinvest的控件的值:                               $("input[name!='hyipinvest']").val();

13.查找所有含有 id 属性的 div 元素:                                                 $(“div[id]“);

14.找到所有含有 id 属性,并且它的 name 属性是以 man 结尾的:                                                     $(“input[id][name$='man']“);

15.选择parent 的直接子节点child. child必须包含在parent中并且父类是parent元素.            $(“.myList>li”)

16.选在id为hibiscus元素后面的 img对象,hibiscus元素与img同级;                                                   $(“#hibiscus+img”)

17.表格首行,末行:                                                                                      $(“tr:first”)                          $(“tr:last”)

18.查找 所有未选中的 input 元素:                                                        $(“input:not(:checked)”)

19.选 择所有h1,h2,h3一类的header标签:                                      $(“:header”)

20.查找所有(不)可见的 tr 元素:                                                              $(“tr:hidden”)                     $(“tr:visible”)

21.查找所有的input元素:                                                                            $(“:input”)

22.查找所有文本框:                                                                                        $(“:text”)

23.查 找所有密码框:                                                                                      $(“:password”)

24.匹配所有单选按钮:                                                                                  $(“:radio”)

25.匹 配所有复选框:                                                                                      $(“:checkbox")

26.查找所有(不)可用的input元素:                                                        $(“input:enabled”)              $(“input:disabled”)

27.css() 方法返回或设置匹配的元素的一个或多个样式属性:
                                                                                                                                      $("p").css({
                                                                                                                                                        "color":"white",
                                                                                                                                                        "background-color":"#98bf21",
                                                                                                                                                        "font-family":"Arial",
                                                                                                                                                        "font-size":"20px",
                                                                                                                                                        "padding":"5px"
                                                                                                                                                      });

28.attr() 方法设置或返回被选元素的属性值:                   $("img").attr({width:"50",height:"80"});    

29. 选取所有 href 值以 ".jpg" 结尾的元素:                                    $("[href$='.jpg']")

30.id="intro" 的 <div> 元素中的所有 class="head" 的元素     $("div#intro .head")

 

 

                                                                                                                                                                                                                       ---------------- 20121219

你可能感兴趣的:(Juqery 总结)