Skip to content

Instantly share code, notes, and snippets.

@scottharvey
Created July 21, 2009 03:47
Show Gist options
  • Save scottharvey/151095 to your computer and use it in GitHub Desktop.
Save scottharvey/151095 to your computer and use it in GitHub Desktop.
(function ($) {
$.fn.editable = function () {
var settings = {
// global setting values go here
}
return this.each(function () {
var $this = $(this); // Cache a jQuery version of this
var tag = $this.get(0).tagName;
// perform element initialisation depending on tag type
switch(tag) {
case 'DIV': initDiv(); break;
case 'IMG': initImage(); break;
}
// functions used by divs only
function initDiv () {
}
function divFunction () {
}
// functions used by images only
functions initImage() {
}
function imageFunction () {
}
// functions used by divs and images
function sharedFunction () {
}
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment