這是我的jQuery code.I需要JavaScript代碼來選擇第n child.Is可以使用JavaScriptn個子在JavaScript
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".gl-testim-text p:nth-child(2)").click(function(){
$(".gl-testim-text p:nth-child(3)").show();
});
});
</script>
看一看 - https://api.jquery.com/nth-of-type-selector/和https://api.jquery.com/nth-child - 選擇器/ – nikhil
'document.querySelectorAll('p:nth-child(n)')' – Abhitalks
@nikhil OP意味着沒有jQuery – Rajesh