[eluser]Unknown[/eluser]
Hey all- I'm new to javascript and I'm trying to use jquery and jeditable.
Here is some code I'm using to make a tr element editable.
$("tr.journal-entry .actions a.edit").click(
function() {
$(".edit").hide();
$(".delete").hide();
$(this).parents("tr").find(".text").click();
return false;
}
);
The code is hiding the edit and delete links on all the entries on the page when this happens. That's exactly what I want. I can't make the links reappear though. Here's what I've currently got:
$('.journal-entry .text').editable(
'<?php echo Router::url("/folder/");?>update', {
id : 'data[entry][id]',
name: 'data[entry][text]',
type: 'textarea',
cancel: 'Cancel',
submit: 'Save',
tooltip: "Edit your journal entry",
onblur: 'ignore'
}
I tried changing the cancel parameter to have a function but it executes as soon as the box is made editable and that doesn't help me.
cancel: function(){
$(".edit").show();
$(".delete").show();
}
That didn't work like I'd hoped - the entry disappears, as do the links. I think because it executes cancel as soon as the button is made. Is there some way to add a function as a parameter that executes when cancel is pressed?