Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQuery Plugin Starter Template
( function( $ ) {
$.fn.helloWorld = function( options ) {
// Establish our default settings
var settings = $.extend( {
text : 'Hello, World!',
color : null,
fontStyle : null,
complete : null
}, options );
return this.each( function() {
$( this ).text( settings.text );
if ( settings.color ) {
$( this ).css( 'color', settings.color );
}
if ( settings.fontStyle ) {
$( this ).css( 'font-style', settings.fontStyle );
}
if ( $.isFunction( settings.complete ) ) {
settings.complete.call( this );
}
} );
}
} ( jQuery ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.