Hide "Not yet answered" in a quiz

Hide "Not yet answered" in a quiz

от Florian Funke -
Количество ответов: 1

Is there a way to hide the text "Not yet answered" in a quiz in CSS?

My students are often confused when they scroll up again and a question they have answered says "Not yet answered". (For questions on the same page).

Thanks for your help!

(Moodle 3.5)

Приложение Bildschirmfoto 2019-09-12 um 09.57.47.jpg
В ответ на Florian Funke

Re: Hide "Not yet answered" in a quiz

от Dominique Bauer -
Изображение пользователя Documentation writers Изображение пользователя Particularly helpful Moodlers Изображение пользователя Plugin developers

Hello Florian,

The message "Not yet answered" is displayed in a <div> element with class="state". If you hide this element using CSS, you will also hide the other messages it contains. I think applying conditions in CSS is difficult if not impossible, at least awkward.

Here is a simple solution that will hide only "Not yet answered":

In Site administration / Appearance / Additional HTML, place the following code in Within Head or When BODY is opened or Before BODY is closed (it does not matter which one you choose):

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>
<script>
    $(document).ready(function() {
        if ($(".state").text() == "Not yet answered") {
            $(".state").html("<br>");
        };
    });
</script>

If you do not have access to the Site administration or if you do not want "Not yet answered" to be hidden throughout your site, you can insert exactly the same code in the HTML of the Question text of your questions. If your have multiple questions displayed on the same page, you only need one question with this code.

I would be interested to know whether this meets your needs.