Permalink
Browse files

Ref impl.

  • Loading branch information...
jzaefferer committed Aug 9, 2010
1 parent 66b43d0 commit 1d550ffaa8c00849f26c8f03f24b1ad3eb229337
Showing with 23 additions and 0 deletions.
  1. +23 −0 jquery.edible-ref.js
  2. 0 jquery.edible.js
View
@@ -0,0 +1,23 @@
+(function($) {
+
+$.widget("cgnjs.edible", {
+ _create: function() {
+ var self = this;
+ this.element.bind("click.edible", function(event) {
+ self.element.hide();
+ self.input.val($.trim(self.element.text())).show().focus();
+ });
+ self.input = $("<input/>")
+ .insertAfter(self.element)
+ .hide()
+ .blur(function() {
+ $(this).hide();
+ self.element.show();
+ })
+ .keyup(function(event) {
+ self.element.text(this.value);
+ });
+ }
+});
+
+})(jQuery);
View
No changes.

0 comments on commit 1d550ff

Please sign in to comment.