javascript - I cant add class to nth-child -
html:
<div id="brojac-poteza" style="clear:both;padding-top:40px;padding-left:60px;padding-right:40px"> <div class="round-end darker-back card-choice">1</div> <div class="darker-back card-choice">2</div> <div class="darker-back card-choice">3</div> <div class="darker-back card-choice">4</div> <div class="darker-back card-choice">6</div> <div class="darker-back card-choice">5</div> <div class="darker-back card-choice">7</div> <div class="darker-back card-choice">8</div> <div class="darker-back card-choice">9</div> <div class="darker-back card-choice">10</div> </div>
script.js
(above code set var g = 1;
)
g += 1; $('#brojac-poteza:nth-child(g)').addclass('round-end');
when test says uncaught error: syntax error, unrecognized expression: :nth-child
change to
$('#brojac-poteza:eq('+g+')').addclass('round-end');
Comments
Post a Comment