Mika Tuupola

Technology guy with passion for advertising.

  • weblog
  • projects
  • cv

Jquery

Tuning Lazy Loader

24 December 2009

I just committed two patches to Lazy Load plugin sent by users. Jeremy Pollock contributed a patch improving scroll behaviour. Before when you scrolled quickly long way down all images above the browser top were loaded. New behavior is to load only those which are currently visible on the screen.

Continue reading

Lazy Load Inside Container

13 February 2009

Matthew Crumley contributed nice patch to Lazy Load plugin which makes it work with containers. If you have a container which has a scrollbar.

#container {
    height: 600px;
    overflow: scroll;
}

Images which are not visible are not loaded until you scroll to them. Check demo page for horizontal and vertical scrolling.

To use new feature you can give the container as jQuery object.

$("img").lazyload({         
     placeholder : "img/grey.gif",
     container: $("#container")
 });

Mathew also patched a bug where IE was not always loading images. To upgrade download the latest source, minified or packed.

Search jQuery API Docs from Spotlight

09 February 2009

Yesterday Priit Haamer of Fraktal notified me about Spotlight searchable Ruby on Rails documentation he had made. Absolutely brilliant idea. When I saw it I knew I have to do same thing for jQuery.

Note: Last update to jQuery Spotlight dictionary was done 19th November 2009. I try to update the docs every month.

Why Is It cool?

You can just hit Apple + Space to enter spotlight and search for jQuery function.

Press and hold Apple + Control + D over any function in TextMate (or Safari, iChat, Mail etc.) to get info popup.

Continue reading

WYSIWYG Inline Edit with Jeditable

06 September 2008

Latest custom input for Jeditable uses jWYSIWYG editor by Juan M Martínez. This code has been almost ready for a while. This week I finally had time to fix some outstanding FireFox bugs.

If you are interested in writing your own Jeditable custom inputs read the introduction. You might also be interested in MarkItUp! custom input which is similar to jWYSIWYG input.

To test see the working demo and then download the source.

Usage

First include all needed JavaScript and CSS in your HTML.

<notextile> <pre> &lt;script src="jquery.js"" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="jquery.wysiwyg.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="jquery.jeditable.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="jquery.jeditable.wysiwyg.js" type="text/javascript"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="jquery.wysiwyg.css" type="text/css"&gt; </pre> </notextile>

Now you can use input type wysiwyg. Set onblur to ignore. Otherwise clicking menubar will cause editing to quit. You should also include atleast submit and cancel parameters. All jWYSIWYG settings can be passed using wysiwyg parameter. Check documentation from Juan’s webpage.

$('.editable').editable('http://www.example.com/save.php', { 
    type      : 'wysiwyg',
    onblur    : 'ignore',
    submit    : 'OK',
    cancel    : 'Cancel',
    wysiwyg   : { controls : { separator04         : { visible : true },
                               insertOrderedList   : { visible : true },
                               insertUnorderedList : { visible : true }
                }
    }
});

I tested the code with IE6, IE7, FF2, Safari and Chrome. In case you find any problems drop me a line.

PUT Support for Jeditable

03 September 2008

Until now Jeditable only supported submitting edited data using POST method. This was against REST principles. POST should be used for creating new objects. PUT should be used for updating existing objects.

Most browsers do not natively support PUT method. Jeditable does it Rails way by using POST method but submitting additional variable called __method_ with value put.

Jeditable now has basic unit tests covering most configuration parameters. If you find any failing tests drop me a line. Download latest as source, minified or packed.

Changes Since 1.6.0

Submit method can now be POST (default) or PUT.

$(".editable").editable("http://www.example.com/save.php", { 
    method : "PUT"
});

Bug where form was submitting twice if using code like below was fixed. Thanks to Hannes Tydén of soundcloud.com for patch.

$(".editable").editable("http://www.example.com/save.php", { 
    settings.submit : '<button type="submit">Save</button>'
});

Note that code below generates exactly the same HTML as code above.

$(".editable").editable("http://www.example.com/save.php", { 
    settings.submit : 'Save'
});

 

Jeditable and TinyMCE

22 July 2008

I have been working with Sam Curren lately improving Jeditable custom input API. At the same time Sam has been working with his TinyMCE custom input.

Inline editing with TinyMCE has been requested several times in mailinglists and forums. After MarkItUp! and WYSIWYG (beta) it is now third content editor plugin for Jeditable.

TinyMCE input needs Jeditable 1.6.0 to work. Download it as source, minified or packed.

Changes Since 1.5.0

You can now call function when onblur is triggered.

$(".editable").editable("http://www.example.com/save.php", { 
    onblur   : function(value, settings) {
        console.log(this);
        console.log(value);
        console.log(settings);
    }
});

Continue reading

MarkItUp! for Jeditable

08 April 2008

In the heels of autogrow textarea comes next custom input for Jeditable. This time we will use markItUp! universal markup editor by Jay Salvat.

If you are not familiar with Jeditable custom inputs read the introduction. Also see autogrow and timepicker tutorials.

If you are just looking for the code download it here.

Creating custom input

Throughout the tutorial we will be using following code to trigger Jeditable. Note variable called markitupHTML . It holds configuration of used markItUp! tagset. In this example I use slightly modified HTML tagset. For more information on tagsets see markItUp! documentation.

$(".edit").editable("http://www.example.com/save.php", { 
    type      : "markitup",
    submit    : 'OK',
    cancel    : 'Cancel',
    tooltip   : "Click to edit.",
    onblur    : "ignore",
    markitup  : markitupHTML
});

Again we start by adding custom input type called markitup.

Continue reading

Autogrow Textarea for Jeditable

04 April 2008

Previously i showed you how to create inline timepicker for Jeditable. This time we will create autogrowing textarea. This custom input will adjust its height while you type. Code uses excellent Autogrow jQuery plugin by Chrys Bader.

If this is your first encounter with Jeditable custom inputs you might want to read an introduction to them.

If you are just looking for the code download it here.

Creating custom input

Throughout the tutorial we will be using following code to trigger Jeditable.

$(".edit").editable("http://www.example.com/save.php", { 
    type      : "autogrow",
    submit    : 'OK',
    cancel    : 'Cancel',
    tooltip   : "Click to edit.",
    onblur    : "ignore",
    autogrow : {
        lineHeight : 16,
        maxHeight  : 512
    }
});

We start by adding custom input type called autogrow.

Continue reading

Lazy Load With Effects

17 March 2008

You can now add some oomph to your Lazy Loaded images. New effect parameter accepts any jQuery effect. When lazy image is loaded plugin will make it appear using chosen effect. Obviously effects such as fadeOut wont work. Use only effects which make image appear, not disappear.

 $("img").lazyload({
     placeholder : "img/grey.gif",       
     effect      : "fadeIn"
 });

To see code above at work, check fadein demo. Are there any other features you would like to see? Leave a comment.

Related entries: Delayed Loading of Images, Lazy Load Sideways, Preload Images Sequentially With jQuery

Creating Inline Timepicker with JavaScript and jQuery

16 February 2008

Inline editing is not only limited to text and textarea inputs. In this tutorial you will learn how to make inline timepicker with JavaScript. We will be using the usual tools: jQuery and Jeditable.

Before continuing you might be interested in reading introduction to custom input types for Jeditable.

Available methods for creating custom input

When creating custom input type you want to define one or several of following methods. None of them are mandatory.

$.editable.addInputType('example', {
    element : function(settings, original) { },
    content : function(string, settings, original) { },
    buttons : function(settings, original) { },
    submit  : function(settings, original) { },
    plugin  : function(settings, original) { },
    reset   : function(settings, original) { }
});

All methods receive two parameters. Settings is Jeditable settings hash. Original is the original element which was clicked. Method content() also receives third parameter string which is the value input should be set to. Inside all methods this represents the form.

For this example we will be using three methods.

Continue reading

Delayed Loading of Images

30 January 2008

Several people have asked me to add timeout option to Lazy Load plugin. As before, only images inside viewport would be loaded and page will come to ready state faster. However browser would load rest of the images automatically after specific amount of time.

I do not think it is necessary to add another configuration option for it. It all can be done with few lines of JavaScript.

Custom events

By default Lazy Load binds to scroll event. When window is scrolled plugin checks if any new images have become visible. For this case we want to use something different. We could use any of the normal jQuery events such as click or dblclick. But lets invent our own event. We will name it sporty.

$(document).ready(function() { $(“img:below-the-fold”).lazyload({ placeholder : “img/grey.gif”, event : “sporty” }); });

Continue reading

Style File Inputs With jQuery (and CSS)

24 October 2007

Frontend coders have a life lasting problem. How to explain art director file inputs can not be styled? File Style to the rescue! It is a jQuery plugin which enable you to do just that. Style file inputs.

Code is inspired by work of Shaun Inman with one main difference. This version mimics vanilla file input by showing what file user has chosen.

How does it work?

Plugin wraps vanilla file input with div. This div has button as background image. Image button is aligned with file inputs browse button. File input is then hidden by setting opacity to zero. Chosen file is shown in normal text input which mimics file input. This text input also inherits file inputs class. Use this class to style the text input.

Continue reading

New Version of Editable Plugin

18 October 2007

Alert! Alert! Another boring new release is out blog entry ahead. If you are bored already go ahead and download latest (1.5.0 at time of writing) Jeditable source, minified (recommended) or packed.

More info and should-be-better documentation at project page.

What is new or changed?

  • Added placeholder parameter. This can be html on plaintext string. It will be shown when editable element is empty.
  • Returned JavaScript is now executed. Allows us
    to do tricks like returning <script>alert(‘Saved!’)</from> from the save
    script.
  • Hacks which supported old getload and postload parameters are now removed. Use loadurl and loadtype instead.
  • Callback should now be given in options hash not as third parameter.

Usage of new or changed options below:

<pre> $(".editable").editable("http://www.example.com/save.php", { placeholder : "Click me to edit", loadurl : "http://www.example.com/load.php", loadtype : "POST", callback: function(value, settings) { console.log(this); console.log(value); console.log(settings); } }); </pre>

 
h3. Thanks

Thanks to Ole Laursen, Dylan Verheul and Mariano Iglesias for providing patches and ideas!

Three Button Editable

21 September 2007

Maybe your get greedy and two buttons in you in place editor is not enough. Maybe your boss says submit and cancel is not enough. He want to have maybe button too. Maybe you want to be as confusing as Excel save dialogue. This is a walkthrough on how to add the third button.

Available methods for creating custom input

When creating custom input type you want to define one or several of these methods. None of them are mandatory.

$.editable.addInputType('example', {
    element : function(settings, original) { },
    content : function(string, settings, original) { },
    buttons : function(settings, original) { },
    submit  : function(settings, original) { },
    plugin  : function(settings, original) { },
    reset   : function(settings, original) { }
});

All methods receive two parameters. Settings is jEditable settings hash. Original is the original element which was clicked. Method content() also receives third parameter string which is the value(s) input should be set to. Inside all methods this represents the form.

Continue reading

Lazy Load Sideways

12 September 2007

Lazy Load plugin has been quite popular recently. Atleast two Prototype ports have been created. First one by Edd Couchmann. Second one by Bram Van Damme. Congrats guys. Now Prototype people can enjoy lazy loading sweetness too.

I just added most requested feature. Sideways lazy loading of images in wide pages. I guess you could also call it right of fold_. Demo page herewide.html.

As an added bonus you get four new selectors: belowthefold, abovethefold, rightoffold and leftoffold. You can get some performance improvements using these. Attach plugin only to images below the fold with:

$(“img:belowthefold”).lazyload();

Or do something with all paragraphs far away right on wide page:

$(“p:rightoffold”).something();

There are still some issues I would like to solve. In meanwhile download latest from the project page.

Related entries: Delayed Loading of Images, Preload Images Sequentially With jQuery, Lazy Load With Effects.

Lazy Load Images jQuery Plugin

03 September 2007

Lazyloader is inspired by YUI ImageLoader Utility by Matt Mlinac. After reading YUI introduction I though this is cool! After reading through source thought changed to this needs some jQuery simplicity So I stole borrowed couple of great ideas from Matt’s code. Result is Lazy Load plugin for jQuery.

What does it do?

It delays loading of images in (long) pages. Images below the fold (far down in the page) wont be loaded before user scrolls down. This is exact opposite of image preloading. With long pages containing heavy image content end user result is the same. Page feels snappier. Browser is in ready state after loading visible images. No need to wait for n pictures to load.

From Wikipedia: Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program’s operation if properly and appropriately used.

That said Matt’s code does much more. I was only after lazy loading and simplicity of use. If you need more features go for YUI.

Show me more!

Demo page is available. For download and usage instructions info see Lazy Load project page. Or check under the hood.

Related entries: Sequentially Preloading Images With jQuery

Lazy Load Plugin for jQuery

03 September 2007

Lazy loader is a jQuery plugin written in JavaScript. It delays loading of images in (long) web pages. Images outside of viewport (visible part of web page) wont be loaded before user scrolls to them. This is opposite of image preloading.

Using lazy load on long web pages containing many large images makes the page load faster. Browser will be in ready state after loading visible images. In some cases it can also help to reduce server load.

Lazyloader is inspired by YUI ImageLoader Utility by Matt Mlinac. Demo page is available.

How to use?

Lazy Load depends on jQuery (doh!) and dimensions by Brandon Aaron (dimensions is now included in jQuery core). Include them in your header:

 <script src="jquery.js" type="text/javascript"></script>
 <script src="jquery.lazyload.js" type="text/javascript"></script>

and in your code do:

$("img").lazyload();

This causes all images below the fold to be lazy loaded.

Setting sensitivity

There are options for control maniacs who need to finetune. You can set threshold on how close to the edge (don’t push me too far) image should come before it is loaded. Default is 0 (when it is visible).

$("img").lazyload({ threshold : 200 });

Setting threshold to 200 causes image to load 200 pixels before it is visible.

Placeholder image

You can also set placeholder image and custom event to trigger loading. Place holder should be an url to image. Transparent, grey and white 1×1 pixel images are provided with plugin.

$("img").lazyload({ placeholder : "img/grey.gif" });

Event to trigger loading

Event can be any jQuery event such as click or mouseover. You can also use your own custom events such as sporty or foobar. Default is to wait until user scrolls down and image appears on the window. To prevent all images to load until their grey placeholder image is clicked you could do:

$("img").lazyload({ 
    placeholder : "img/grey.gif",
    event : "click"
});

Using effects

By default plugin waits for image to fully load and calls show to show it. You can use any effect you want. Following code uses fadeIn effect. Check how it works at effect demo page.

$("img").lazyload({ 
    placeholder : "img/grey.gif",
    effect : "fadeIn"
});

Images inside container

You can also use plugin for images inside scrolling container, such as div with scrollbar. Just pass the container as jQuery object. There is a demo for horizontal and vertical container.

#container {
    height: 600px;
    overflow: scroll;
}
$("img").lazyload({         
     placeholder : "img/grey.gif",
     container: $("#container")
});

When images are not sequential

After scrolling page Lazy Load loops though unloaded images. In loop it checks if image has become visible. By default loop is stopped when first image below the fold (not visible) is found. This is based on following assumption. Order of images on page is same as order of images in HTML code. With some layouts assumption this might be wrong. You can control loading behaviour with failurelimit option.

$("img").lazyload({ 
    failurelimit : 10
});

Setting failurelimit to 10 causes plugin to stop searching for images to load after finding 10 images below the fold. If you have a funky layout set this number to something high.

Delayed loading of images.

Not exactly feature of Lazy Load but it is also possible to delay loading of images. Following code waits for page to finish loading (not only HTML but also any visible images). Five seconds after page is finished, below the fold images are loaded automatically. You can also check the delayed loading demo.

$(function() {          
    $("img:below-the-fold").lazyload({
        placeholder : "img/grey.gif", 
        event : "sporty"
    });
});
$(window).bind("load", function() { 
    var timeout = setTimeout(function() {$("img").trigger("sporty")}, 5000);
}); 

Download

Latest source or minified.

Known problems

Due to webkit bug #6656 Lazy Loading wont give you any improvements in Safari. It will load all images you wanted it or not. You can workaround this with

It seems jQuery 1.3.x breaks the plugin for IE. All images get loaded in the background even when they should not. I am working on it. In the meanwhile stay with jQuery 1.2.6.

Also you are using Mint you should have mint tag in the header of the page. Mint tag in the end of the page interferes with Lazy Load plugin. This is rather peculiar problem. If somebody finds an answer let me know.

Custom input types for edit in place

07 August 2007

I have received many feature requests lately. Most of them have been worth of adding. People have different needs. But I have been worrying about Jeditable becoming feature creep. Thats why I figured out another aproach.

For those in hurry. Check the custom input types demo for some proof on concept inputs.

Write your own input types

Sometimes you need multiple selects. Your form might need special third button which is not submit or cancel. Sometimes you want to use some other plugin such as Date Picker for editing.

There is no point adding separate parameter for all of these. Code would become bloated. Thus I have been working on enabling other developers to add new input types. Think of it as plugins for in place editor plugin.

Continue reading

Preload Images Sequentially With jQuery

05 June 2007

!http://www.appelsiini.net/images/jquery.gif (jQuery)! Here is a small code snippet I use for preloading images for mouseovers. It uses _$(window).bind(‘load’, function() {

Continue reading

Pass Data to Edit In Place With Function

06 April 2007

Small update to jQuery eip plugin. Data parameter is now more flexible. Bug with callback function launching too early is fixed.

In earlier versions you could use functions for two things. To submit edited data to function which takes full control of Ajax request. You could also define optional callback function. This function is called after submitting edited data. Starting from 1.3.1 release you can also use functions as data property. Instead of passing static string you can pass function which generates the data.

Continue reading

ThickBox Macro For Mephisto - jQuery and Rails

26 March 2007

Some people consider it to be heretic to use jQuery with Ruby on Rails. Since I am big fan of jQuery I decided to do it anyway.

With filtered_column_thickbox_macro you can display single or multiple images with Lightbox effect. Macro uses Cody Linley’s ThickBox plugin. Code is based on Based on Christian Lim’s Lightbox Image Gallery Filter.

Installation

Install by issuing command (in one line):

script/plugin install http://svn.appelsiini.net/svn/rails/plugins/filtered_column_thickbox_macro/

Script will copy needed Javascript, CSS and image files into your public folder. It does not overwrite any existing files. So if you rely in specific version of jQuery library it will be safe.

Continue reading

In Place Edit With Callback

22 March 2007

jQuery in place edit is now close to have all features it needs. Add some more and it will become feature creep. Most features are configurable. You can even get full control on Ajax request. Just write your own function for submitting and post to this function instead of URL. Smartypants!.

As usual, download latest source or test online.

Using callback function

Now you can define optional callback function. This function is called after form has been submitted. Callback function receives two parameters. Value contains submitted form content. Settings contain all plugin settings. Inside function this refers to the original element.

$(“.editable”).editable(“http://www.example.com/save.php”, { type : “textarea”, submit : “OK”, }, function(value, settings) { console.log(this); console.log(value); console.log(settings); });

Continue reading

In Place Editing With Selects

13 March 2007

Several people already asked support for selects and possibility to pass CSS class or styles as parameter to jQuery inplace editor. Here they are.

Big thanks goes to Mathias Henze for providing patches and ideas making this release possible!

For those in hurry: test and grab the latest source.

NOTE! JUST FOUND OUT THIS RELEASE HAS PROBLEMS WITH IE. WILL RERELEASE IN FEW HOURS AND KICK MYSELF THREE TIMES FOR NOT DEBUGGING IN WINDOWS!

How to use selects?

You can use selects by giving type parameter value of select. Select is built from JSON encoded array. This array can be given using either data parameter or fetched from external URL given in loadurl parameter. Array keys are values for <option> tag. Array values are text shown in pulldown.

Continue reading

jEditable 1.1.1 - Minor Bugfixes

15 February 2007

Latest release of javascript in place editor plugin has some minor bugfixes. In near future postload and getload parameters will be deprecated in favour of loadurl and loadmethod.

Fixed bugs are:

  • Cancel button now works even when onblur is set to ignore. Thanks to Thomas Mann for providing the patch.
  • Plugin does not break the chain even when attached to nonexistent element. In other words it returns this instead of false in case of failure.

As usual test and download plugin.

Valentine Day Cards With jQuery and PHP

07 February 2007

We just finished latest joint project with finnish EGO. Result is Valentine’s Day card campaign for the main newspaper in Finland. Users choose between six prefined picture frames. Upload best picture of themselves (photoshopped or not). Write a nice poem to their loved one. After the masterpiece is finished they can send the card immedietly or at chosen time.

Typical way of working in advertising world is not most pleasant. Insane deadlines. Clients doing last minute changes. With these things in mind, you can not spend too much time coding basic things. With jQuery we were able to concentrate on needed features:

  • Photo should be zoomed with magnifying glass icons.
  • Photo should be panned by dragging it with mouse.
  • Greeting text should be previewed live while typing.
  • No Flash.

Campaign site also uses date picker plugin by Kelvin Luck

jEditable 1.1.0 - Compatible with jQuery 1.1

17 January 2007

New release adds inplace editing capabilities for recently released jQuery 1.1.

In addition to compatibility changes new or improved options are:

  • data : string Alternative to postload and getload. Instead of fetching content from external resource it can be passed as parameter.
  • cancel : string Value for optional cancel button.
  • submit : string Empty value does not default to ‘OK’ anymore. If you want to have submit button you have to define this option.

As usual test and download plugin.

Edit In Place With Effects

30 December 2006

Graphical effects can be used to improve user experience.

People have been asking me to add configurable effects into jEditable. I believe in writing reusable code. This also means I do not want to force people use anything specific including graphical effects I happen to like. I believe people should be able to use any 3rd party effects they want to use.

Luckily jQuery makes this easy to implement. Just add effects you want to same element selector you make editable.

For example you want to change background colour to yellow when move mouse over editable area:

$(document).ready(function() {
    $(".editable").mouseover(function() { 
        $(this).css('background-color', '#ffffd3');
    });
    $(".editable").mouseout(function() { 
        $(this).css('background-color', '#fff');
    });
    $(".editable").editable("http://www.example.com/save.php", { 
        indicator : "<img src='img/indicator.gif'>",
        type      : "textarea",
        tooltip   : "Click to edit..."
    });
});

Or use higlightFade plugin by Blair Mitchelmore for more elegant effect:

    $(".editable").mouseover(function() { 
        $(this).highlightFade({end:'#ffffd3'});
    });
    $(".editable").mouseout(function() { 
        $(this).highlightFade({end:'#fff', speed:200});
    });
    $(".editable").editable("http://www.example.com/save.php", { 
        indicator : "<img src='img/indicator.gif'>",
        tooltip   : "Click to edit..."
    });
});

Check above examples in in place editor with fx / effects test page.

jEditable 1.0.0 - Doubleclick to Edit

21 December 2006

First stable version of jQuery Javascript in place editor is out of oven. Existing api will be frozen. I will add new features in near future.

I only added one bugfix and one feature since last release candidate. These are:

  • Width and height setting of auto now works with all input types.
  • New configurable option submit controls value of submit button. Empty value means no submit button. Textareas still have default submit button with value ‘OK’. Scrap that. I do not want force users to have submit button when using textareas. Besides when onblur=submit the submit button is not even needed.

New submit option is used as follows:


$(document).ready(function() {
$(“.edit”).editable(“http://www.example.com/save.php”, {
type : ‘text’,
submit : ‘Save changes’
});
});

As always test and download plugin.

jEditable 1.0.0RC1 - Configurable OnBlur Event

31 October 2006

Thanks to community support jEditable now has additional features and new bugfixes. First stable release is almost there.

New release of jQuery in place editable plugin fixes following bugs:

  • When textarea size was set to auto width and height were incorrectly set. To be exact px was missing from the property.
  • Also when using auto size the width and height was only calculated once. Thus if you edited content more than once, textarea size did not change according to new content.
  • All instances of $ are now changed to jQuery.
  • When attaching jEditable to nonexistent element elem has no properties error is no more thrown.

Thanks to Nagy Attila Gabor and Gary for providing patches!

Additionally new configuration parameter onblur was added. Possible values and corresponding behaviors are:

  • onblur : ‘cancel’ Clicking outside editable area cancels changes. Clicking OK button submits changes.
  • onblur : submit’ Clicking outside editable area submits changes.
  • onblur : ‘ignore’ Click outside editable area is ignored. Pressing ESC cancels changes. Clicking OK button submits changes.

As always test new features and download plugin.

jEditable 0.9.2 - Ideas From EditInPlace

11 October 2006

While looking at Joseph Scott’s EditInPlace I realized jEditable missed one important thing. Possibility to configure event which starts editing. Default is click.

This is now implemented via options[event]. You can use any jQuery events such as click, dblclick, mouseover or mousemove. Out of these example event the first two are naturally the most usefull ones. Additionally some internal changes were made in order to follow jQuery plugin authoring guidelines better.

Download latest version of jQuery in place editor plugin while its hot!

jEditable 0.9.1 - Now With Tooltips and Autosizing

30 September 2006

Just released next version of jQuery inplace editor plugin. This version has two improvements. Textarea input element can be automatically sized to match the size of edited element. This is also default behaviour. Additionally an optional tooltip via title attribute is supported.

jEditable 0.9.0 - In Place Editor for jQuery

29 September 2006

It has been a while since I last was really excited about something. Few days ago I found jQuery.

jQuery states itself as New Wave JavaScript. I have had experience with prototype and script.aculo.us. Both are great libraries. However I never felt comfortable them. I just used them.

With first impression about jQuery’s syntax is bit confusing:

$(document).ready(function() {
    $("a[@href*=/foo/bar]").click(function() {
        alert('Click...');
    });
});

After reading that jQuery’s main developer John Ressig is also a Perl coder it all makes sense. I assume the fact that I did code Perl “back in the days” makes me feel comfortable also with jQuery.

InPlaceEditor

While converting old prototype + script.aculo.us projects to jQuery + interface combinations I also needed an InPlaceEditor plugin. Searching Google revealed several but none of them had all features I needed. Especially possibility to use Textile or Markdown rendering.

So i took the one which i liked to most: Dylan Verheul’s editable. and made a rewrite. Result is jEditable. At the moment main features are:

  • Editable element does not need to be wrapped with form tag.
  • Id of edited element is automatically sent when saving changes.
  • Can be used with external xhtml renderers such as Textile, Markdown, ReST or any WiKi renderer.
  • Build to be reuseable. Does not include any visual efects.

You can check live demo and download jEditable. Bug reports are welcome!



@tuupola