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.

not able to add css class to survey question

See original GitHub issue

I am trying to highlight the question if there is a particular condition is met. So, I have set the following css class for the question when the condition is met: survey.getQuestionByName(“questionName”).cssClasses.mainRoot = " bq-info";

But, the question does not get highlighted when the condition is met! Am I doing it a wrong way? Note that the css class “bq-info” is legit.

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

asking a question

What is the current behavior?

The question does not get highlighted when the condition is met! Am I doing it a wrong way? Note that the css class “bq-info” is legit.

What is the expected behavior?

The question’s css class should be set to whatever class is provided by the user.

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

Provide the test code and the tested page URL (if applicable)

Tested page URL:

Test code

your_code_here

Specify your

  • browser: chrome
  • browser version: 84+
  • surveyjs platform (angular or react or jquery or knockout or vue): jquery
  • surveyjs version: 1.8.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewtelnovcommented, Oct 15, 2020

@till-tomorrow Sorry, did not get the question at first. Here is the working example.

Thank you, Andrew

0reactions
till-tomorrowcommented, Oct 15, 2020

I am afraid, this does not seem to work. Am I doing something wrongly?

survey.onUpdateQuestionCssClasses.add(function(survey, options) {
    var classes = options.cssClasses;
    options.question.hasError = "";
    if(options.question.description.includes("some text"))
        classes.title = "sq-title";
]);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Add additional css-classes for easier styling - surveyjs Support
Hello. We would like to use or custom styles for tags in question of type "html", but the problem is that we can't...
Read more >
Assign custom class to question elements? — XM Community
As far as I can tell, there is no way to add a custom class to question elements - is that right? It's...
Read more >
Css Сlasses, Angular Survey Library Example - SurveyJS
Css Сlasses · 1. Radiogroup question (green). Clear · 2. Checkbox question (orange) · 3. Required question (red title) *. Clear.
Read more >
Add CSS class to question - LimeSurvey forums
Hi, I would like to change the CSS of some questions uniformely without the hassle of copy-pasting a lot. Is it possible to...
Read more >
Lesson 1: Understanding ID and Class in CSS
You want to be able to link to a particular element within a web page. In fact, you already added id="main" to one...
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