Even a task as simple as this can be complicated without jQuery at our disposal. In plain JavaScript, we could add the highlightedclass as shown in the following code snippet: window.onload = function() { var divs = document.getElementsByTagName('div…