Creating The Edit and Save Features
The first step is to include the prototype.js in our html.
Next, we're going to write a series of JavaScript functions to implement the edit and save feature.
init function
In the init function we invoke a event listen on our edit and save button as defined in our HTML code.
/* Create click event listener for both edit and save button
* This function is loaded during page load.
*/
function init()
{
//call function edit_in_place when user click on teh edit button
Event.observe("edit", "click", function(e){ edit_in_place() });
//call function save when user clicks on the save button
Event.observe("save", "click", function(e){ save() });
}