Jquery Using Jeditable and activating on click
Posted
by BandonRandon
on Stack Overflow
See other posts from Stack Overflow
or by BandonRandon
Published on 2009-10-19T03:22:05Z
Indexed on
2010/05/24
15:41 UTC
Read the original article
Hit count: 355
I found this to be almost exactly what I'm trying to do. I'm using Jeditable I can get the default setup to work. I've also been able to get the code in the forum above to work. I believe my problem is that because I'm using a table I need to so something else to select the previous element.
Here is my HTML
<table>
<tr>
<td width="5%"><input class="cat_checkbox" type="checkbox" name='delete_cat[]' value='<?php echo("$cat_data[cat_id]");?>' /></td>
<td width="90%" class="edit_cat_title" id='unique_id'>Category</td>
<td width="5%"><a href="#" class="edit_cat_title_trigger"><img src="images/edit.gif" border="0"></a></td>
</tr>
</table>
and here is my JQuery:
//modify title content on the fly
$('.edit_cat_title').editable('action.php', {
name : 'cat_title',
indicator : 'Saving...',
submit : 'OK',
cancel : 'Cancel',
tooltip:'click to edit',
event : 'edit'
});
//trigger with the click of the edit image
$(".edit_cat_title_trigger").bind("click", function() {
$(this).prev().trigger("edit_cat_title");
});
I know I probably should be able to figure it out and I know all i have to do is change $(this).prev().trigger("edit_cat_title");
to the right thing but I'm still really new to Jquery.
Thanks
© Stack Overflow or respective owner