Clint Eastwood Clint Eastwood - 19 days ago 4
HTML Question

How to catch click event on an editable DataTable cell?

I use jQuery DataTable and I have an editable cell for entering scores. When use double click this field the cell is editable and I want to catch this event so that making the cell text selected as shown below:

$("td form input").focus(function () {
concole.log('catched...');
});


or like that:

$('#dtbGrade td form').focus(function () {
concole.log('catched...');
});


But I cannot catch the event when user double clicked the cell and the cell is focused. On the other hand the rendered html of the cell is as shown below (unnecessary lines was removed for brevity):

<table id="dtbGrade" role="grid" aria-describedby="dtbGrade_info">
<td>
<form>
<input autocomplete="off" name="value">
</form>
</td>
</table>


Any idea to catch the dbclick event of this editable table cell?

Answer

I have tried all of the suggetions above but anyhow none of them has not been worked. The worked code as shown below. If there is an edit needed comments are welcome... Thanks a lot Syden and Cris.

$('#dtbGrade').dblclick(function () {
    console.log("catched");
    $('#dtbGrade td form input').select();
});