pre selecting radio button on quiz page.

iftikhar_shahid
Offline
Last seen: 3 years 5 months ago
Thu, 09/07/2017 - 08:07
#1
pre selecting radio button on quiz page.

hi,
i wonder how to preselect a radio button on quiz page?
i am using quiz-1.html template for quiz page on my project. i want to render the radio buttons in a way that if an answer was already selected, it should be preselected at the time of rendering. and i figure that to render this, i must add class "active" in the

  • element. but this does not seem to work. here is my code snippet.

    @foreach (var answer in Model.currentQuestion.Answers)
    {
    string cls = "";
    if (answer.isSubmitted)
    {
    cls = "active";
    }

  • @answer.Description

  • }

    please guide me how to make a radio button pre-selected?