editable table...fields not editable after first change

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lmerry
    New Member
    • Jan 2012
    • 1

    #1

    editable table...fields not editable after first change

    I'm using the following code to make fields in a table editable. Everything is working fine except that once a field is changed, the field is no longer clickable and the edit box will not reappear until the page is reloaded.

    Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/
    ajax/libs/jquery/1.5/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    {
            $(".edit_td").click(function()
            {
                    var i=$(this).attr('id');
                    $("#jan_"+i).hide();
                    $("#jan_input_"+i).show();
            }).change(function()
            {
                    var clientID="<?php echo $clientID; ?>";
                    var i=$(this).attr('id');
                    var cell=$("#jan_input_"+i).val();
                    var dataString= 'clientID='+clientID+'&changecell='+i+'&data='+cell;
                    $("#"+i).html('<img src="load.gif" />');
                    $.ajax({
                            type: "POST",
                            url: "ajax_edit.php",
                            data: dataString,
                            cache: false,
                            success: function(html)
                            {
                                    $("#"+i).html(cell);
                            }
                    });
            });
            $(".editbox").mouseup(function()
            {
                    return false
            });
    
            $(document).mouseup(function()
            {
                    $(".editbox").hide();
                    $(".text").show();
            });
    });
    </script>
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Could you post a sample of the corresponding HTML code.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      It's probably because the code is hiding the edit box.

      Comment

      Working...