“JavaScript anak ke -n” Kode Jawaban

css anak yang aneh bahkan

tr:nth-child(even) {background: #CCC}
tr:nth-child(odd) {background: #FFF}
Alive Albatross

nth-child () CSS

/* Selects the second <li> element in a list */
li:nth-child(2) { 
  color: lime;
}

/* Selects every fourth element
   among any group of siblings */
:nth-child(4n) {
  color: lime;
}
Repulsive Rhinoceros

bagaimana mendapatkan anak ke -n dari dom js

 //method one 
  var c = document.getElementById("myDIV").childNodes;
  c[1].style.backgroundColor = "yellow";//first child
  c[2].style.backgroundColor = "red";//second child
  c[-1].style.backgroundColor = "green";//last child
  c[-2].style.backgroundColor = "blue";//secound last child
//method two
 let nth-child = document.querySeletorAll('myDiv:nth-child(n)');//gives nth child 
uzii

CSS Nth Child


:nth-child(1) { /*advantage is you can do it for 2nd, 3rd etc. */
	/* styles go here*/  
}
Batman

JavaScript Dapatkan Elemen Anak ke -2

//you can use the css nth-child property like this:
var second-child = document.querySeletorAll('[your element name]:nth-child(2)');
Wicked Warbler

JavaScript anak ke -n

2
3
4
5
6
7
8
9

0

0
0
Average Alpaca

Jawaban yang mirip dengan “JavaScript anak ke -n”

Pertanyaan yang mirip dengan “JavaScript anak ke -n”

Lebih banyak jawaban terkait untuk “JavaScript anak ke -n” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya