Hide "Not yet answered" in a quiz

Re: Hide "Not yet answered" in a quiz

by Dominique Bauer -
Number of replies: 0
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of 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.