Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add dynamic click handler to jeditable

I'm trying update a table cell using jeditable so when the user clicks the cell it becomes editable. Below code works fine :

    $(".click").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", { 
                indicator : "<img src='img/indicator.gif'>",
                tooltip   : "Click to edit...",
                style  : "inherit"
            });

<b class="click" style="display: inline">Click me if you dare!</b></> 

But when I try to edit a cell that has been dynamically added to the table using jQuery :

$("#rounded-corner tbody").append("<td class='clicked'>row</td>");

The event does not fire. How can this be fixed ? I think I may have to use the .on function ?

like image 817
blue-sky Avatar asked Nov 04 '22 08:11

blue-sky


1 Answers

Use the on() method -

$('body').on('click', '.click', function(){....
like image 56
Jay Blanchard Avatar answered Nov 12 '22 13:11

Jay Blanchard