Clint Eastwood Clint Eastwood - 1 year ago 100
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 () {

or like that:

$('#dtbGrade td form').focus(function () {

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">
<input autocomplete="off" name="value">

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

Answer Source

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 () {
    $('#dtbGrade td form input').select();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download