Register | Log in | Password |

365 projects | 71 services | 215 websites | 1073 freelancers | 2763 topics | advertise


Purchase JoomlaWatch:
30 day money-back guarantee
Read more...
9 EUR lifetime license
Buy Now

15 EUR lifetime license
Buy Now
(nofollow link from sponsors page)

Login:

22.8%United States United States
15.5%India India
7.3%Russian Federation Russian Federation
6.9%Colombia Colombia
6.1%Germany Germany
5.1%United Kingdom United Kingdom
4.4%Poland Poland
3.4%Netherlands Netherlands
3%France France
2.8%Canada Canada

Today: 1370
Yesterday: 1639
This Week: 4595
Last Week: 10059
This Month: 11294
Total: 34608

Users

Most active users today from total of 67:
matto, rottenberg, billspo, crony, Adelavigne, dwlamb, dontbugmeplease, eghtedar, manuelflores, rockiesrider, Machin, FreeMe, michmich, infomech, speru, blombo, sunconcept, rtuszyns, tegralens, Pedropedro
About JoomlaWatch:
JoomlaWatch is popular joomla visitor tracking and live stats component. It provides several features such as spam blocking, goals tracking, charts, nightly email reports, latest visit map, interactive HTML5 traffic flow graph and many other useful functionalities, which will help you to optimize your site.
RSS Feeds:

rss Freelance
rss Projects
rss Forum
rss Resources

Home

jQuery in place editor plugin tutorial

Introduction

jQuery is an open source cross browser javascript library . jQuery is a very popular javascript library and has a lot of plug-ins for a wide variety of task . JQuery has got plug-ins from simple task like form validation to a lot of complex behavior. In this article I am going to discuss some of the very useful plug-ins of jQuery to do in place editing.

 

Jeditable

 

Jeditable is a very handy and small jQuery in place editor plug in . This plug in helps you make a lot of HTML elements directly in place editable with just a few lines of code

This plug in can be downloaded from

 

http://www.appelsiini.net/projects/jeditable

 

You can also get more information about it on

 

http://plugins.jquery.com/project/jeditable

 

 

Once you have downloaded jQuery and jeditable using this plug in is very simple.

I will start with a very simple e.g:-

 




Jeditable Demo








click to Update Text Here

This example creates a div element and clicking on it will make it editable. Once the user clicks on it and makes changes and clicks the data is posted to the script 'updatedata.php' (below the code for updatedata.php is shown).

 

In this example first I have created a <dev> element using

<div class="div_txt" id="div_text">click to Update Text Here</div>

 

 

 

To make this element in place editable you just have to add

 

 

$(document).ready(function() {

$('.div_txt').editable('updatedata.php');

});

 

 

 

The only mandatory parameter is the complete URL where the data will be posted when the user changes the content.( in our case its 'updatedata.php' or it could be http://abc.com/updatedata.php ) . My updatedata.php just echoes the value back so that it is displayed to the user back

 

<?php

//Add Code here to $_POST['id'] and $_POST['value'] and update

//in a database or file

echo $_POST['value']; // Return the changed value so that is displayed to the user

?>

 

 

Adding buttons and tool tips

 

We can even add Ok and cancel buttons when the user tries to edit the content in place. So when the user clicks Ok the data is posted to updatedata.php . We can also add a tool tip which can give instructions to the user like ‘Click to edit’

 

So if I add a new div element to my page as follows

<div class="div_txt_area" id="div_txt_area">Click on text here</div>

 

Then the following code

 

$('.div_txt_area').editable('updatedata.php', {

type : 'textarea',

cancel : 'Cancel',

submit : 'OK',

tooltip : 'Click to edit...'

});

 

will add two buttons when the user is editing the text as Ok and Cancel .

Also when the user hovers the mouse over the div the tool tip will be shown as 'Click to edit...'

 

 

 

Other Features

 

This plug-in has a lot of other features like

  • To use selects in , in-place edition

  • To specify a load url from which data is loaded in a Text area

  • To post data to a function instead of an URL

 

You can read a complete list of features with code examples at http://www.appelsiini.net/projects/jeditable

 

 

Another In-Place Editor

 

An another good jQuery in place editor plug in is the ‘Another In-Place Editor ‘

 

This is also a very good plug-in which makes HTML elements in place editable .

This plug in can be downloaded from http://code.google.com/p/jquery-in-place-editor/

 

Once you have downloaded this plug in and jQuery using this plug-in is also very simple .

An example to demo its usage is as follows

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>

<title>Another In-Place Editor</title>

<script src="/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>

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

 

<script type="text/javascript" charset="utf-8">

 

$(document).ready(function() {

$("#div_text").editInPlace({

url: "updatedata2.php"

});

 

});

 

 

 

</script>

</head>

 

<body>

 

<p id="div_text">

Click to Update Text Here

</p>

 

</body>

</html>

 

Like the above example for Jeditable I have created one div element using

<p id="div_text"> Click to Update Text Here </p>

 

 

 

To make this element in place editable with ‘Another In-Place Editor ‘

You have to just add

 

$("#div_text").editInPlace({

url: "updatedata2.php"

});

 

 

This will make the element div_text in place editable and when the value is changed by the user and presses enter the data is posted to url parameter specified. (In our example it is updatedata2.php )

 

The parameters which are posted to the URL are

 

  • original_html; The original value in the element prior to the post

  • update_value; The value which the user changed

  • element_id; The ID of the current element



<?php

//Add Code here to add or update $_POST['update_value']

//in a database or file

echo $_POST['update_value']; // Return the changed value so that is displayed to the user

?>

The updatedata2.php just echoes the value back so that it is displayed to the user back

 

Adding a select for in place edit

 

We can even add a select in the in place edit so that the user can choose from options while editing. Once the user will select the value the data will be posted to url specified.

 

To do this I will have to create a div element

 

<p id="div_select">Click Here to Choose country</p>

The following code will add a select to the in place edit

$("#div_select").editInPlace({

url: "updatedata2.php",

field_type: "select",

select_options: "USA, UK , Australia"

});

 

To add the select you will have to add the parameter field_type as"select" and specify the options in select_options parameter.

Other Features

Some of the other features of this plug in are

  • Adding a saving image or saving text while the save happens on the server.

  • This plugin allows to submit to a callback function rather than to the server URL

  • This plug in allows validation of blank field



For a list of more features you can visit http://code.google.com/p/jquery-in-place-editor/

Some other good jQuery in place editor plug-ins

Following are some other jQuery plug-in which can be used for in place editor functionality

Conclusion

jQuery and its plug-ins have really changed the way UI is developed for websites now. The plug in described in this article make is very easy to make a UI in websites where there is need In place editable elements. Adding in place elements just take a few lines of code with the use of these plug-ins.



 

 

 

Add comment


Security code
Refresh


no license? questions?

Recommended: (advertise)
Joomlawatch 1.2.17 Demo (PRO: 9/15 EUR)
Download Joomlawatch 1.2.17 (PRO: 9/15 EUR)



Rate this extension ...


Stay in touch:

New online JoomlaWatch demo available here: (link)
12 hours ago from web

New comprehensive article on JoomlaWatch goals: (link)

JoomlaWatch is now available for Drupal as unlocked BETA version for testing: (link)
3 days ago from web

New article about JoomlaWatch Live Stats feature: (link)
5 days ago from web

Tested versions 1.2.12 FREE, 1.2.17 PRO, 1.2.18 BETA on Joomla 2.5 and older Joomla 1.5 - confirmed to work on both Joomla versions
2 weeks ago from web

Small installer fixes - added JoomlaWatch compatibility with Joomla 2.5
2 weeks ago from web

New article on JoomlaWatch Traffic Flow feature: (link) ... All features of JoomlaWatch will be documented this way.
2 weeks ago from web

Another minor fixes for version 1.2.17 and 1.2.18, added functionality to display only changed values in SEO report - important keyprases
2 weeks ago from web

Minor fixes for JoomlaWatch version 1.2.17 (language files), you can find the latest package in customer zone ((link)
3 weeks ago from web

If you'd like to help with testing of the latest 1.2.18 BETA with new features (Joomla/Wordpress),please add me on skype: matto3c.Thank you!

New article on JoomlaWatch SEO (Search Engine Optimization) report functionality - (link)

JoomlaWatch 1.2.18 is out now! Features new click heatmap feature, SEO report - how people find you on google, and many other improvements

Reorganized the menu items. Now you'll be able to easily find most requested links

JoomlaWatch 1.2.18 BETA now ready! Main features: - Heatmap integration - SEO reports - Anti-spam section visualization (link)

Fixed one issue: no unique visits recorded; PHP $_SERVER['REMOTE_ADDR'] doesn't always return remote IP address! using HTTP_X_FORWARDED_FOR

Christmas Special - 19% OFF from all licenses until 25th of December 2011

JoomlaWatch Heatmap functionality nearly done. Works with all client resolutions. Will be available in next version. (link)

Simple customer zone - (link) is now ready. Users who purchased the PRO version can now download newest version from there.

Because of the problems with payments and forwarding. We are using (link) service to deliver you the files after purchase.

Tracking Expenses from SMS android application is now published on android market :) and it's completely free !



Partners:
Freelance ColdFusion, Flex, PHP

Olejomalby, abstraktne obrazy

Camping Europe

WinAsm Studio

Vyšné Ružbachy

Sochy, Reštaurovanie

R.E.M.

Valid XHTML 1.0 Transitional

RSS feed:

Statistics:
Search Engine Genie Promotion Widget
Privacy policy | Advertise | Donate

Locations of visitors to this page


©2003-2010 Codegravity.com