MediaWiki:Common.js: Difference between revisions

From Celeste Wiki
Content deleted Content added
commented out all other JS as it doesn't work anyway (???)
try reducing errors by checking for button presence
Line 94:
// (test) Replaces image
 
if (document.getElementById('replaceImageButton').addEventListener('click', function() {
document.getElementById('replaceImageButton').addEventListener('click', function() {
// Get a reference to the container element by its ID
var container = document.getElementById('containerID');
// Find the image element within the container
var imageElement = container.querySelector('img');
// Replace the image source with a new one
imageElement.src = document.getElementById('newImageURL').innerText;
});
}