From 67c8c9b493b9ccf079457794e2a530128003c5c5 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Mon, 26 Sep 2016 18:28:35 +0100 Subject: [PATCH] MDL-56069 quiz: nav buttons don't scroll to the right question When there is more than one question on a page, say questions 2, 3 & 4. Then when you click the navigation button for Q4, then it should load the next page scrolled down so that Q4 is visible. That was not working. --- mod/quiz/module.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/mod/quiz/module.js b/mod/quiz/module.js index aaa39264513..b613c13982a 100644 --- a/mod/quiz/module.js +++ b/mod/quiz/module.js @@ -154,25 +154,12 @@ M.mod_quiz.nav.init = function(Y) { var form = Y.one('#responseform'); if (form) { - function find_enabled_submit() { - // This is rather inelegant, but the CSS3 selector - // return form.one('input[type=submit]:enabled'); - // does not work in IE7, 8 or 9 for me. - var enabledsubmit = null; - form.all('input[type=submit]').each(function(submit) { - if (!enabledsubmit && !submit.get('disabled')) { - enabledsubmit = submit; - } - }); - return enabledsubmit; - } - function nav_to_page(pageno) { Y.one('#followingpage').set('value', pageno); // Automatically submit the form. We do it this strange way because just // calling form.submit() does not run the form's submit event handlers. - var submit = find_enabled_submit(); + var submit = form.one('input[name="next"]'); submit.set('name', ''); submit.getDOMNode().click(); };