MediaWiki:Common.js: Difference between revisions
From Celeste Wiki
Content deleted Content added
shortened even more, maybe this fixes the issue |
seems like jQuery does not work, reversing |
||
Line 94: | Line 94: | ||
// (test) Replaces image |
// (test) Replaces image |
||
document.addEventListener('DOMContentLoaded', function() { |
|||
$j( function() { // ensures that script will run after all content is loaded (jQuery) |
|||
var button = document.getElementById('replaceImageButton'); |
|||
$j('#replaceImageButton').click(function() { // adds an onClick event listener for an element with id=replaceImageButton |
|||
button.addEventListener('click', function() { |
|||
// Get a reference to the container element by its ID |
// Get a reference to the container element by its ID |
||
var container = document.getElementById('containerID'); |
|||
/* |
|||
// Find the image element within the container |
// Find the image element within the container |
||
var imageElement = container. |
var imageElement = container.querySelector('img'); |
||
// Replace the image source with a new one |
// Replace the image source with a new one |
||
imageElement.src = |
imageElement.src = getElementByID('newImageURL'); |
||
*/ |
|||
}); |
}); |
||
}); |
}); |