Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- });
- }));
Add Comment
Please, Sign In to add comment