Created
November 21, 2009 12:42
-
-
Save padolsey/240115 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(yourNodes).append(jQuery('<a>Click</a>').click(function(){ | |
| var self = this.parentNode, // parentNode is a single element within yourNodes | |
| loading = $('<div>LOADING</div>').appendTo(self), | |
| id = self.id.replace(/^edit/,''); | |
| // Retrieve textarea from server | |
| jQuery.get('/getDataForTextArea?id=' + id, function(textareaValue){ | |
| loading.remove(); | |
| var textarea = jQuery('<textarea/>') | |
| .attr('id', 'txt' + id) | |
| .val(textareaValue) | |
| .add( | |
| jQuery('<button>Save</button>') | |
| .attr('id', 'btnSave' + id) | |
| .click(function(){ /* Click handler */ }) | |
| ) | |
| .add( | |
| jQuery('<button>Cancel</button>') | |
| .attr('id', 'btnCancel' + id) | |
| .click(function(){ | |
| /* Remove nodes */ | |
| tr.remove(); | |
| }) | |
| ); | |
| var tr = jQuery('<tr colspan="4"><td/></tr>'); | |
| tr.find('td').append(textarea); | |
| tr.appendTo(self); | |
| }); | |
| })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment