Chain programming and implicit iteration

Programming Chain

  • In an exclusive ideology, for example, set the style for the current element, clear style of its siblings
  • Chain programming is not used
$(this).css("color","red")
$(this).siblings().css("color","")
  • The use of chain programming
$(this).css("color","red").siblings().css("color","")

Implicit iterative

  • jQuery automatically traverses the DOM element dummy memory array, the respective method or styling
  • Such as setting the style for li, li will change all
$("li").css("color","red")

Here Insert Picture Description

Published 135 original articles · won praise 0 · Views 3076

Guess you like

Origin blog.csdn.net/qq_35764106/article/details/105332472