question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DOM manipulation in onAfterRenderQuestion

See original GitHub issue

Are you requesting a feature, reporting a bug or ask a question?

Asking a question

What is the current behavior?

Using insertBefore on htmlElement passed to onAfterRenderQuestion has no effect.

What is the expected behavior?

DOM manipulation persists.

How would you reproduce the current behavior (if this is a bug)?

    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.

Specify your

  • browser: Chrome
  • browser version: 62.0.3202.94
  • surveyjs platform (angular or react or jquery or knockout or vue): jquery
  • surveyjs version: 0.12.35

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewtelnovcommented, Dec 15, 2017

@alasdaircr It should be fine from the next minor, v0.98.4

Thank you, Andrew

1reaction
dmitrykurmanovcommented, Nov 21, 2017

ok. If you need help, feel free to ask us.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DOM manipulation in onAfterRenderQuestion #779 - GitHub
Using insertBefore on htmlElement passed to onAfterRenderQuestion has no effect. What is the expected behavior? DOM manipulation persists. How ...
Read more >
Using onAfterRenderQuestion to update DOM - surveyjs Support
I'm trying to use onAfterRenderQuestion to add elements to the DOM. While it works, the event evidently fires whenever the question is ...
Read more >
Manipulating documents - Learn web development | MDN
We have reached the end of our study of document and DOM manipulation. At this point you should understand what the important parts...
Read more >
how to label in between surveyjs radio group - Stack Overflow
I have added the code with considering basic DOM element position. survey .onAfterRenderQuestion .add(function(){ $( //first I have collected ...
Read more >
How to do DOM Manipulation properly in Angular?
There are many ways to manipulate the DOM in Angular. Let's use them instead of straight forward JavaScript approaches. Usually, there are two...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found