Talk:How to enhance wiki content with JavaScript

This howto is easy to understand also without js skill. but I had to change the js code (from MediaWiki:YourScript.js) as it is described here http://jsfiddle.net/7f9uko44/ (thanks to Krinkle from "mediawiki-l Mail-List"). I did the import code as recommended with importScript('MediaWiki:YourScript.js') (in MediaWiki:Common.js); and create a Template:HelloWorld and use that within pages but nothing happens. Do I forgot to activate or to allow js in mediawiki settings? In LocalSettings.php I set: $wgUseSiteJs = true; $wgAllowUserJs = true; $wgAllowUserCss = true; Is there any simple way to check js is running in my mediawiki? Ggtuem (talk) 14:16, 4 September 2014 (UTC)

why not support js newbies with a "hello world" howto? Ggtuem (talk) 10:57, 5 September 2014 (UTC)

Example Hello World!!!
Here is a quick step-by-step for Hello World!!!:

Add to the following MediaWiki:Common.js: (function {

var myElement = document.getElementById('mw-hello-world'); myElement.innerHTML = ' Hello World!!! ';

});

Create the page Template:Helloworld with the following:

Go to a regular page in the wiki and add the following:

You should see Hello World!!! on the page after saving. Nephron (talk) 02:05, 28 October 2016 (UTC)

importScript is now depricated
importScript is now depricated

Please replace the code snippet under Separate Script with the updated version See https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript#importScript

Thanks.