:nth-child(2) seems to select something inside of child 1.
child 1 and child 3 work correctly.
It doesn't seem to involve the type of tag, as several similar but different questions do. I don't see the problem.
https://jsfiddle.net/rhedin/em56jk9v/
var one = document.querySelector('div.rules :nth-child(1)');
var two = document.querySelector('div.rules :nth-child(2)');
var three = document.querySelector('div.rules :nth-child(3)');
one.classList.add('arule');
two.classList.add('brule');
three.classList.add('crule');
.arule {
background-color: yellow;
}
.brule {
background-color: red;
}
.crule {
background-color: blue;
}
<div class="rules">
<div>
<label for="rule1">Rule1</label>
<input id="rule1">
</div>
<div>
<label for="rule2">Rule2</label>
<input id="rule2">
</div>
<div>
<label for="rule3">Rule3</label>
<input id="rule3">
</div>
</div>