I have a pick, group, and rank question with 32 items, set to display stacked so as not to overwhelm the survey-taker. I would like to have a counter on the page that indicates how many items are remaining in the stack (they must rank all items). There are two groups the items can be ranked into. I haven’t found much information on the forums about using JS with pick, group, and rank questions, so I’m a little lost. So far I have the following, which I don’t think is working:
var group1count=jQuery("#" +this.questionId+"group0 li").length;
var group2count=jQuery("#" +this.questionId+"group1 li").length;
var remaining = 32 - group1count - group2count
Qualtrics.SurveyEngine.setEmbeddedData( 'remaining_n', remaining);
Here is a screenshot of how the question looks on the page (the stack of items has a length of 32 before any ranking occurs, and we want somewhere on the page to show how many are left in a dynamic way):

If anyone can give me some pointers on a) how to get the length of the stacked items and have this update every time a new item is moved to a group, and b) how to have this value displayed somewhere on the page, I would be very grateful!
Thank you very much