Difference between revisions of "MediaWiki:Common.js"

From Leaving The Cradle Wiki
Jump to navigation Jump to search
Line 3: Line 3:
(function ()  
(function ()  
{
{
var myElement = document.getElementById('mw-time-calculator');
var calculatorBody = document.getElementById('mw-time-calculator');
if (myElement)
if (calculatorBody)
{
{
var msgElement = document.createElement('b');
var msgElement = document.createElement('div');
var msgText = document.createTextNode('Hello world<br><input type="number" name="mw-tc-earth" title="Earth years" id="mw-tc-earth">');
var timeEarth = document.createElement('input');
timeEarth.setAttribute("type", "number");
timeEarth.setAttribute("name", "mv-time-earth");
timeEarth.setAttribute("placeholder", "0");
var msgText = document.createTextNode('Hello world');


msgElement.appendChild(msgText);
msgElement.appendChild(timeEarth);
myElement.appendChild(msgElement);
calculatorBody.appendChild(msgElement);
}
}
}());
}());

Revision as of 04:48, 11 December 2022

/* Any JavaScript here will be loaded for all users on every page load. */

(function () 
{
	var calculatorBody = document.getElementById('mw-time-calculator');
	if (calculatorBody)
	{
		
		var msgElement = document.createElement('div');
		var timeEarth = document.createElement('input');
		timeEarth.setAttribute("type", "number");
		timeEarth.setAttribute("name", "mv-time-earth");
		timeEarth.setAttribute("placeholder", "0");
		
		var msgText = document.createTextNode('Hello world');

		msgElement.appendChild(timeEarth);
		
		calculatorBody.appendChild(msgElement);
		
	}	
}());