By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

editable table...fields not editable after first change

P: 1
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.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <script type="text/javascript" src="http://ajax.googleapis.com/
  3. ajax/libs/jquery/1.5/jquery.min.js"></script>
  4. <script type="text/javascript">
  5. $(document).ready(function()
  6. {
  7.         $(".edit_td").click(function()
  8.         {
  9.                 var i=$(this).attr('id');
  10.                 $("#jan_"+i).hide();
  11.                 $("#jan_input_"+i).show();
  12.         }).change(function()
  13.         {
  14.                 var clientID="<?php echo $clientID; ?>";
  15.                 var i=$(this).attr('id');
  16.                 var cell=$("#jan_input_"+i).val();
  17.                 var dataString= 'clientID='+clientID+'&changecell='+i+'&data='+cell;
  18.                 $("#"+i).html('<img src="load.gif" />');
  19.                 $.ajax({
  20.                         type: "POST",
  21.                         url: "ajax_edit.php",
  22.                         data: dataString,
  23.                         cache: false,
  24.                         success: function(html)
  25.                         {
  26.                                 $("#"+i).html(cell);
  27.                         }
  28.                 });
  29.         });
  30.         $(".editbox").mouseup(function()
  31.         {
  32.                 return false
  33.         });
  34.  
  35.         $(document).mouseup(function()
  36.         {
  37.                 $(".editbox").hide();
  38.                 $(".text").show();
  39.         });
  40. });
  41. </script>
  42.  
Jan 2 '12 #1
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
Could you post a sample of the corresponding HTML code.
Jan 4 '12 #2

Rabbit
Expert Mod 10K+
P: 12,430
It's probably because the code is hiding the edit box.
Jan 4 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.