Difference between revisions of "MediaWiki:Common.js"

From UMaine SECS Numerical Modeling Laboratory
Jump to: navigation, search
Line 2: Line 2:
  
 
$(function () {
 
$(function () {
 +
  var myElement = document.getElementById('displayText');
 +
  myElement.innerHTML = 'any HTML';
 +
}());
 +
  
 +
$(function () {
 
   var myElement = document.getElementById('dropdown');
 
   var myElement = document.getElementById('dropdown');
 
   myElement.innerHTML = 'any HTML';
 
   myElement.innerHTML = 'any HTML';
  
 +
  var newForm = document.createElement('form');
 +
  newForm.action='/path_to_script_that_changes_image.js';
 +
  var newInput = document.createElement('input');
 +
  newInput.list = 'Viscosities';
 +
  var newDataList = document.createElement('datalist');
 +
  datalist.id = 'Viscosities';
 +
  var newViscosity = function (viscosity) {
 +
    var newOption = document.createElement('option');
 +
    newDataList.appendChild(newOption);
 +
    newOption.value = viscosity;
 +
  };
 +
  newViscosity(10)
 +
  newViscosity(100)
 +
  newViscosity(1000)
 
}());
 
}());

Revision as of 21:08, 19 February 2019

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

$(function () {
  var myElement = document.getElementById('displayText');
  myElement.innerHTML = 'any HTML';
}());


$(function () {
  var myElement = document.getElementById('dropdown');
  myElement.innerHTML = 'any HTML';

  var newForm = document.createElement('form');
  newForm.action='/path_to_script_that_changes_image.js';
  var newInput = document.createElement('input');
  newInput.list = 'Viscosities';
  var newDataList = document.createElement('datalist');
  datalist.id = 'Viscosities';
  var newViscosity = function (viscosity) {
    var newOption = document.createElement('option');
    newDataList.appendChild(newOption);
    newOption.value = viscosity;
  };
  newViscosity(10)
  newViscosity(100)
  newViscosity(1000)
}());