Asking a question
Using insertBefore on htmlElement passed to onAfterRenderQuestion has no effect.
DOM manipulation persists.
survey.onAfterRenderQuestion.add(function(survey, options){
var div = document.createElement("div");
div.innerHTML = "Q"+options.question.no;
div.className = 'sv_q_no';
options.htmlElement.insertBefore(div, options.htmlElement.querySelector('h5'));
options.htmlElement.appendChild(div);
});
The <div class="sv_q_no">Q1</div> element is appended after the question but not inserted before.
Chrome62.0.3202.94jquery0.12.35I think, you don't use insertBefore correctly. I've created an example: https://plnkr.co/edit/39Wy5KTYelDisl9etit3?p=preview, please check it.
This is maybe a chrome bug for me then? Your example doesn't work either

Do you see Q1 in front of 1. * What car are you driving?
no i see it "after", but I think that this is another issue, in the first case we don't see label at all :)
I've fixed the example: https://plnkr.co/edit/39Wy5KTYelDisl9etit3?p=preview (removed unneded appendChild)
For some reason it doesn't work for me - the insertBefore operation is broken. Perhaps it's a problem with jQuery. This survey is hosted on a wordpress site. I'll investigate.
Thanks for looking into it.
ok. If you need help, feel free to ask us.
Closer to triaging this issue - Preact is removing the element during a rerender diff operation. I can get the elements to appear by going to the next page. Then once I answer a particular question the element is diff'd away.
Why this behaviour is different to your example I'm not sure - but you will see that if you answer the question in your example the question number element is removed.
survey.onAfterRenderQuestion is not called when the question re-renders due to an answer being selected.
@alasdaircr It should be fine from the next minor, v0.98.4
Thank you,
Andrew