Blur function instead of mouseup function not working as desired
<p>I have the <a href="http://www.centerwow.com/stackoverflow/shape/TableEdit2.php" rel="nofollow">Demo Table</a> which I can click on the cell(td tag) and I can change the value  on it.direct php DataBase.
To do that I need to contain two <strong>tags.1 - span. 2 - input.</strong>
like the below.</p>

<pre><code>&lt;td class='Name'&gt;
 &lt;span id="spanName1" class="text" style="display: inline;"&gt; Somevalue  &lt;/span&gt;
 &lt;input type="text" value="Somevalue" class="edittd" id="inputName1" style="display: none; "&gt;   
&lt;/td&gt;
</code></pre>

<p>To control the data inside the cell I use in jquery .<strong>mouseup function.</strong>
mouseup works but also makes trouble.
I need to replace it with blur function but when I try to replace mouseup with blur
the program does not work because, when I click on the cell I am able to enter the input tag and I can change the value but I am not successful in Leaving the tag/field by clicking out side the table, which alow me to update the DataBase
You can see the  <a href="http://www.centerwow.com/stackoverflow/shape/TableEdit3.php" rel="nofollow">Demo with blur Here</a>.
What do you advice me to do?</p>

<pre><code>$(".edittd").mouseup(function() {
        return false;
    });
  //*************
    $(document).mouseup(function() {
        $('#span' + COLUME + ROW).show();
        $('#input'+ COLUME + ROW ).hide();
        VAL = $("#input" + COLUME + ROW).val();
        $("#span" + COLUME + ROW).html(VAL);

        if(STATUS != VAL){
            //******ajax code
                 //dataString = $.trim(this.value);
                      $.ajax({
                        type: "POST",
                         dataType: 'html',
                         url: "./public/php/ajax.php",
                         data: 'COLUME='+COLUME+'&amp;ROW='+ROW+'&amp;VAL='+VAL, //{"dataString": dataString}
                             cache: false,
                             success: function(data)
                             {
                                $("#statuS").html(data);
                                }
                             });
                      //******end ajax
                      $('#statuS').removeClass('statuSnoChange')
                        .addClass('statuSChange');
                         $('#statuS').html('THERE IS CHANGE');
                         $('#tables').load('TableEdit2.php');
                 }
                 else
                 {
                 //alert(DATASTRING+'status not true');
                 }
        });//End mouseup function
</code></pre>

<p>I change it to:</p>

<pre><code>$(document).ready(function()
{
    var COLUMES,COLUME,VALUE,VAL,ROWS,ROW,STATUS,DATASTRING;
    $('td').click(function() {
        COLUME = $(this).attr('class');   
      });
//****************
    $('tr').click(function() {
        ROW = $(this).attr('id');
        $('#display_Colume_Raw').html(COLUME+ROW);
        $('#span' + COLUME + ROW).hide();
        $('#input'+ COLUME + ROW ).show();
      STATUS = $("#input" + COLUME + ROW).val();
    });
  //******************** 
    $(document).blur(function() {
        $('#span' + COLUME + ROW).show();
        $('#input'+ COLUME + ROW ).hide();
        VAL = $("#input" + COLUME + ROW).val();
        $("#span" + COLUME + ROW).html(VAL);

        if(STATUS != VAL){
            //******ajax code
                 //dataString = $.trim(this.value);
                      $.ajax({
                        type: "POST",
                         dataType: 'html',
                         url: "./public/php/ajax.php",
                         data: 'COLUME='+COLUME+'&amp;ROW='+ROW+'&amp;VAL='+VAL, //{"dataString": dataString}
                             cache: false,
                             success: function(data)
                             {
                                $("#statuS").html(data);
                                }
                             });
                      //******end ajax
                      $('#statuS').removeClass('statuSnoChange')
                        .addClass('statuSChange');
                         $('#statuS').html('THERE IS CHANGE');
                         $('#tables').load('TableEdit2.php');
                 }
                 else
                 {
                 //alert(DATASTRING+'status not true');
                 }
        });//End mouseup function
        $('#save').click (function(){
            var input1,input2,input3,input4="";
                input1 = $('#input1').attr('value');
                input2 = $('#input2').attr('value');
                input3 = $('#input3').attr('value');
                input4 = $('#input4').attr('value');
                $.ajax({
                    type: "POST",
                    url: "./public/php/ajax.php",
                    data: "input1="+ input1 +"&amp;input2="+ input2 +"&amp;input3="+ input3 +"&amp;input4="+ input4,
                    success: function(data){
                        $("#statuS").html(data);
                        $('#tbl').hide(function(){$('div.success').fadeIn();});
                        $('#tables').load('TableEdit2.php');
                    }
                });
        });
});
</code></pre>
