Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('.editRow').live('click', function() {
- var row = $(this).parent('td').parent('tr');
- row.find('.1u').slideUp('fast');
- row.find('.1p').slideUp('fast');
- row.find('.inputTxt').slideDown('fast');
- $(this).parent('td').empty().append('<a href=# class=cancel>Cancel</a> / <a href=# class=save>Save</a>');
- });
- $('.cancel').live('click', function () {
- var row = $(this).parent('td').parent('tr');
- row.find('.1u').slideDown('fast');
- row.find('.1p').slideDown('fast');
- row.find('.inputTxt').slideUp('fast');
- $(this).parent('td').empty().append('<a href=# class=editRow>Edit</a>');
- });
- $('.save').live('click', function () {
- var thisParam = $(this);
- var row = $(this).parent('td').parent('tr');
- var id = row.attr('id');
- var userid = row.find('#1ui').val();
- var pass = row.find('#1pi').val();
- $.ajax({
- type: 'post',
- url: 'filefetch_update.php',
- data: 'action=updateUser&pass=' + pass + '&id=' + id + '&userid=' + userid,
- success: function(response) {
- $('#response').fadeOut('500').empty().fadeIn('500').append(response);
- var row = thisParam.parent('td').parent('tr');
- row.find('.1u').text(userid).slideDown('fast');
- row.find('.1p').text(pass).slideDown('fast');
- row.find('.inputTxt').slideUp('fast');
- thisParam.parent('td').empty().append('<a href=# class=editRow>Edit</a>');
- }
- });
- });
- $(document).keypress(function(e) {
- if (e.which == 13) {
- $('.save').click();
- }
- )};
- <input type="text" onkeypress="return runScript(event)" />
- function runScript(e) {
- if (e.keyCode == 13) {
- // do some thing like
- $('.save').click();
- }
- }
- $('.your-text-field').live('keypress', func)
Add Comment
Please, Sign In to add comment