📜  jQuery | :odd 选择器

📅  最后修改于: 2021-11-24 04:27:50             🧑  作者: Mango

jQuery :odd 选择器用于从元素中选择奇数索引。索引的编号从 0 开始。工作方式与:even选择器相同,但适用于奇数。

句法

$(":odd")

示例 1:



  

    
      
  

  

  
    
        

GeeksForGeeks

                                                                                                                                                                                                                                                                                                                                                                                            
CompanyCountry
relianceIndia
flipkartIndia
walmartAmerican
Ernst HandelAustria
Island TradingUK
    
     

输出:

示例 2:



  

    
     
  

  

  
    
        

Welcome To GeeksForGeeks       

                                                                                                                                                                                                                                                                    
StateCapital
uttar pradeshlucknow
punjabchandigarh
haryanacandigarh
    
     

输出: