title: javascript error: ReferenceError: edit is not defined edit(this);
body: <p>I have an html file, in which, i want to edit the fields.
  Following is my html code : </p>
  
  <pre><code>  &lt;body&gt;
    &lt;div class= "table"&gt;
    &lt;div class = "thead"&gt;
    &lt;div class = "tr"&gt;
  
      &lt;div class = "td"&gt;ID&lt;/div&gt;
     &lt;div class = "td"&gt;GROUP NAME&lt;/div&gt;
     &lt;div class = "td"&gt;GROUP DESCRIPTION&lt;/div&gt;
      &lt;div class = "td"&gt;IS ACTIVE&lt;/div&gt;
     &lt;div class = "td"&gt;&lt;/div&gt;
     &lt;div class = "td"&gt;&lt;/div&gt;
     &lt;/div&gt;
     &lt;/div&gt;
  
  &lt;div class= "tbody"&gt;
   &lt;form  class = "tr"&gt;
     &lt;div class = "td"&gt;1&lt;/div&gt;
     &lt;div class = "td"&gt;hello&lt;/div&gt;
     &lt;div class = "td"&gt;hwryou&lt;/div&gt;
     &lt;div class = "td"&gt;y&lt;/div&gt;
     &lt;div class = "td action" &gt;&lt;button type="button "onclick="edit(this);"&gt;edit&lt;/button&gt;     &lt;/div&gt;
    &lt;form&gt;
     &lt;/div&gt;
    &lt;/div&gt;
     &lt;/body&gt;
  </code></pre>
  
  <p>following is my javascript code : </p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript" src="serialize-0.2.min.js"&gt;
  
   function edit(element){
      var tr = jQuery(element).parent().parent();
      if(!tr.hasClass("editing")) {
              tr.addClass("editing");
              tr.find("DIV.td").each(function(){
                      if(!jQuery(this).hasClass("action")){
                              var value = jQuery(this).text();
                              jQuery(this).text("");
                              jQuery(this).append('&lt;input type="text" value="'+value+'"   /&gt;');
                      } else {
                              jQuery(this).find("BUTTON").text("save");
                      }
              });
      } else {
              tr.removeClass("editing");
              tr.find("DIV.td").each(function(){
                      if(!jQuery(this).hasClass("action")){
                              var value = jQuery(this).find("INPUT").val();
                              jQuery(this).text(value);
                              jQuery(this).find("INPUT").remove();
                      } else{ jQuery(this).find("BUTTON").text("edit");
                      }}); }
     }&lt;/script&gt;
  </code></pre>
  
  <p>while creating the out put, when i click the edit button, it is showing the reference error edit is not defined.what may be reason for that?</p>
  
  <p><strong>updated :</strong> </p>
  
  <p>i have an other requirement that, on clicking the save button, the changed content should be saved in the database.How can and where i should write the update query? also i required a delete button so that on clicking the delete button, an update command should run.HOw can i achieve this ?/</p>