Jqueryのテクニック

1239 ワード

1. 

  var count = $("ul[@pid = '5']").length ; if (count == 0) ;  return "  ";return " ";

   //     UL    PID  5 ,       ELSE

 

2.

   this.mainUl.find("li").mouseover(function(i) { }); //  UI     UI,        

 

3.

  this.mainUl.parent().find("ul").each(function() { }); //        UI,        

 

4.

    //          

    $(#testSelect option:selected').text();

     $("#testSelect").find('option:selected').text();

     $("#testSelect").val();

5.

    $("#select").empty();//     

6.    

    $("input[@type=checkbox][@checked]").val(); //              

    //             ,        

    $("input[@type=checkbox][@checked]").each(function(){

     alert($(this).val());});

    $("#chk1").attr("checked",'');//         

    $("#chk2").attr("checked",true);//        

    if($("#chk1").attr('checked')==undefined)return '  ';retuen '  '//        

    $('#select_id')[0].selectedIndex = 1;//select               (     )

8.

     $("input[@type=radio][@checked]").val(); //   radio(      RADIO  ):