Guest User

Untitled

a guest
May 24th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. $('.editRow').live('click', function() {
  2. var row = $(this).parent('td').parent('tr');
  3. row.find('.1u').slideUp('fast');
  4. row.find('.1p').slideUp('fast');
  5. row.find('.inputTxt').slideDown('fast');
  6. $(this).parent('td').empty().append('<a href=# class=cancel>Cancel</a> / <a href=# class=save>Save</a>');
  7. });
  8.  
  9. $('.cancel').live('click', function () {
  10. var row = $(this).parent('td').parent('tr');
  11. row.find('.1u').slideDown('fast');
  12. row.find('.1p').slideDown('fast');
  13. row.find('.inputTxt').slideUp('fast');
  14. $(this).parent('td').empty().append('<a href=# class=editRow>Edit</a>');
  15. });
  16.  
  17. $('.save').live('click', function () {
  18. var thisParam = $(this);
  19. var row = $(this).parent('td').parent('tr');
  20. var id = row.attr('id');
  21. var userid = row.find('#1ui').val();
  22. var pass = row.find('#1pi').val();
  23.  
  24. $.ajax({
  25. type: 'post',
  26. url: 'filefetch_update.php',
  27. data: 'action=updateUser&pass=' + pass + '&id=' + id + '&userid=' + userid,
  28.  
  29. success: function(response) {
  30. $('#response').fadeOut('500').empty().fadeIn('500').append(response);
  31. var row = thisParam.parent('td').parent('tr');
  32. row.find('.1u').text(userid).slideDown('fast');
  33. row.find('.1p').text(pass).slideDown('fast');
  34. row.find('.inputTxt').slideUp('fast');
  35. thisParam.parent('td').empty().append('<a href=# class=editRow>Edit</a>');
  36. }
  37. });
  38. });
  39.  
  40. $(document).keypress(function(e) {
  41. if (e.which == 13) {
  42. $('.save').click();
  43. }
  44. )};
  45.  
  46. <input type="text" onkeypress="return runScript(event)" />
  47. function runScript(e) {
  48. if (e.keyCode == 13) {
  49. // do some thing like
  50. $('.save').click();
  51. }
  52. }
  53.  
  54. $('.your-text-field').live('keypress', func)
Add Comment
Please, Sign In to add comment