User:Sur/common.js: Difference between revisions
< User:Sur
m Blanked the page Tags: Blanking Manual revert |
mNo edit summary |
||
Line 1: | Line 1: | ||
function storeValue() { | |||
// Get the input value | |||
var inputValue = document.getElementById('inputValue').value; | |||
// Use JavaScript to dynamically update the #var (normally handled by PHP in the wiki environment) | |||
mw.loader.using('mediawiki.util', function () { | |||
var updatedText = '{{#vardefine:storedValue|' + inputValue + '}}'; | |||
mw.util.addCSS(updatedText); | |||
}); | |||
// Optional: Reload the page to reflect the new stored value in the displayed content | |||
location.reload(); | |||
} |
Revision as of 00:05, 23 September 2024
function storeValue() {
// Get the input value
var inputValue = document.getElementById('inputValue').value;
// Use JavaScript to dynamically update the #var (normally handled by PHP in the wiki environment)
mw.loader.using('mediawiki.util', function () {
var updatedText = '{{#vardefine:storedValue|' + inputValue + '}}';
mw.util.addCSS(updatedText);
});
// Optional: Reload the page to reflect the new stored value in the displayed content
location.reload();
}