Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I've tried a few different ways to change the title of a link within the navigation block through Javascript, but to no avail.
Is there something that I am missing?
Here's the original code via the site:
id="left-side" href="https://forum.tuteehub.com/tag/class">class="ic-app-course-menu list-view" style="display: block"> <href="https://forum.tuteehub.com/tag/span">span id="section-tabs-header-subtitle" href="https://forum.tuteehub.com/tag/class">class="ellipsis">Sandboxhref="https://forum.tuteehub.com/tag/span">span> role="navigation" aria-label="Courses Navigation Menu"> id="section-tabs"> href="https://forum.tuteehub.com/tag/class">class="section"> href="/courses/16289" title="Home" href="https://forum.tuteehub.com/tag/class">class="home" tabindex="0">Home href="https://forum.tuteehub.com/tag/class">class="section"> href="/courses/16289/external_tools/375" title="Course Syllabus" href="https://forum.tuteehub.com/tag/class">class="context_external_tool_375" tabindex="0">Course Syllabus href="https://forum.tuteehub.com/tag/class">class="section"> href="/courses/16289/modules" title="Modules" href="https://forum.tuteehub.com/tag/class">class="modules active" tabindex="0">Modules href="https://forum.tuteehub.com/tag/class">class="section"> href="/courses/16289/grades" title="Grades" href="https://forum.tuteehub.com/tag/class">class="grades" tabindex="0">Grades href="https://forum.tuteehub.com/tag/class">class="section"> href="/courses/16289/users" title="People" href="https://forum.tuteehub.com/tag/class">class="people" tabindex="0">People
Here is the Javascript I'm using to attempt to change the title "Course Syllabus" to just "Syllabus"
if (ENV.current_user_roles.indexOf("admin") < 1){ $( document ).ready(function() { document.querySelector('#section-tabs a.context_external_tool_375').innerHTML = "Syllabus"; }); }
You have the exact right idea, and your code should work as expected. However, your conditional to check whether the user is an admin should really come inside of your $(document).ready(). Having said that, it will still trigger the way you have it now.
$(document).ready()
As such, there can only be two possible things causing your script not to work for you:
Including jQuery and substituting the condition for one that is always true shows the name change working, as can be seen in the following example:
$(document).ready(function() { if (1) { document.querySelector('#section-tabs a.context_external_tool_375').innerHTML = "Syllabus"; } });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">script> id="left-side" class="ic-app-course-menu list-view" style="display: block"> id="section-tabs-header-subtitle" class="ellipsis">Sandbox role="navigation" aria-label="Courses Navigation Menu"> id="section-tabs"> class="section"> href="/courses/16289" title="Home" class="home" tabindex="0">Home class="section"> href="/courses/16289/external_tools/375" title="Course Syllabus" class="context_external_tool_375" tabindex="0">Course Syllabus class="section"> href="/courses/16289/modules" title="Modules" class="modules active" tabindex="0">Modules class="section"> href="/courses/16289/grades" title="Grades" class="grades" tabindex="0">Grades class="section"> href="/courses/16289/users" title="People" class="people" tabindex="0">People
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.