tdzr

常用到的知识点,在此记录,以便查阅

$(\'.test\').parent();//父节点

$(\'.test\').parents();//全部父节点

$(\'.test\').parents(\'.test1\');//含有类名.test1的父节点

$(\'.test\').children();//全部子节点

$(\'.test\').children(\'li\');//元素为li的全部子节点

$(\'.test\').prev();//上一个兄弟节点

$(\'.test\').prevAll();//之前所有兄弟节点

$(\'.test\').next();//下一个兄弟节点

$(\'.test\').nextAll();//之后所有兄弟节点

$(\'.test\').siblings();//所有兄弟节点

$(\'.test\').siblings(\'.test1\');//含有类名.test1的所有兄弟节点

$(\'.test\').find(\'.test1\');//返回被选元素含有类名为.test1的所有后代元素;(返回全部用 * ,多个参数用 , 隔开)

$(\'.test\').contents();//返回元素里面所有内容,包括文本和节点

$(\'.test\').contents(\'.test1\');

分类:

技术点:

相关文章:

  • 2021-11-12
  • 2021-11-14
  • 2021-10-19
  • 2021-12-10
  • 2021-11-28
  • 2021-10-09
  • 2021-12-22
  • 2021-12-22
猜你喜欢
  • 2021-12-10
  • 2021-12-10
  • 2021-12-10
  • 2021-09-07
  • 2021-12-10
  • 2021-12-26
相关资源
相似解决方案