[Answer]-Django jquery hide by default

1👍

The :nth-child(3) will match the third child element. In your case, it won’t be very elegant solution, because those children have mixed CSS classes.

Specifically, your filtered elements (with class fields) are 2nd, 4th and 6th child, respectively.

Instead, you might want to do slicing with jQuery:

$(function(){
    $('li.fields').slice(1).hide();
    // and then the on-click stuff...
});
👤frnhr

Leave a comment