Category:Snippets with JavaScript

From MediaWiki.org
Jump to: navigation, search
Language: English  • 日本語

How to use[edit | edit source]

You can use these snippets in any resource loader module. Those generated by core (such as the site and user module generated from wiki pages) or in an extensions.

Most snippets assume that they are executed after the document is ready, for those cases, make sure that you have a document-ready wrapper in your code. If you don't have one already, use the below:

jQuery( document ).ready( function( $ ) {
	// Paste snippet here
	// Paste as many as you like, only one "jQuery document ready" wrapper is needed!
} );
//
//   (Optionally) you may use the following syntax 
//    It is a shortcut method (less keystrokes). 
//    It means the same thing as the above syntax:
//
$(function( $ )  {
	// Paste snippet here
	// Paste as many as you like, only one "$(function( $ ) { ... } );" wrapper is needed!
} );