[ARCHIVED] Change text on "Take the Quiz" button?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've been trying to mimic what was done in this discussion to change the text on the "Take the Quiz" button in a Canvas quiz. Many of our quizzes are not actual quizzes; rather, just assignments that are better suited to be delivered as a "quiz" in Canvas.
That being the case, I am looking to change the "Take the Quiz" text on the quiz button to say something different, like "Begin Assignment".
I am tech savvy, but a novice in JavaScript. I have admin access to be able to upload custom JavaScript files to Canvas. Our instance currently has custom JavaScript and CSS files included.
I've tried updating the code and reuploading the JavaScript file in the theme editor, but what I've tried hasn't worked. Either my code is wrong, or I'm adding it incorrectly to the JavaScript file. Code:
- $(document).ready(function(){
- $('a.btn.btn-primary.take_quiz_link').text('Begin');
- });
Can any of you point me in the right direction here? Any advice is much appreciated.
Thanks,
Jake
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this:
$("#take_quiz_link").text("Begin")
However, relying on CSS IDs is a bit risky with jQuery code is a bit risky as Instructure will at some time potentially change their UI such that the CSS ID could become no longer relevant someday down the road. It is the institutions responsibility if they make use of JS overrides for the Canvas UI to check each release for potential UI breakage.
You can also base it off of a jQuery filter by a URL pattern. The <a> element selector in jQuery syntax can use a pattern for the href property. The URL in the <a> element for the 'Take Quiz' button contains the string of 'take?' in it. Since Canvas calls its own API, that's less likely to change than a UI/CSS change so this expression may last longer:
$('a[href*="take?"]').text("Begin")
Hope that helps.
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.