Skip to content

Instantly share code, notes, and snippets.

@BrandonDH BrandonDH/amp_dashboard.js

Last active Apr 16, 2019
What would you like to do?
function compareUsers() {
// Get current logged in user
let currentUser = document.getElementById('current-user');
let userToTest = currentUser.innerText;
// Create a list of PMs
let pmList = document.getElementsByTagName('label');
// Iterate through the list
for (i = 0; i < pmList.length; i++) {
pmItem = pmList[i].innerText;
pmInput = pmItem.previousElementSibling;
// Check if that user is in the PM list
if (pmItem == userToTest) {
// Toggle checked value to true
if (pmInput.checked == false) {
pmInput.checked = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.