couldn't set Cursor in search box
couldn't set Cursor in search box
asmfmahmud
Posts: 1Questions: 1Answers: 0
I have created a link with the following code:
<a class="add cboxElement" href="<?php echo base_url();?>product_operation_list/index/<?php echo $row['employee_id'];?>" title="Product Operation List">Click To Assign Operation</a>
which opens colorbox with a table styled by jquery dataTable plugin.The code of the other linked file is ;
$(document).ready(function() {
$('#searchOperationTable').dataTable( {
"pagingType": "full_numbers"
} );
} );
I want to set my cursor in the dataTable's search box by using the following code in the other file;
$(document).ready(function() {
$('div.dataTables_filter input').focus();
} );
But it does not work.
This discussion has been closed.
Answers
You've left out a lot to help focus on the problem, but I think you need to give us more. Do you really have two document.ready calls? That sounds like a timing issue. Where and when are you initializing dataTables? This .focus() needs to happen after DT completes. Try moving that .focus() to the InitComplete configuration option.
https://datatables.net/reference/option/initComplete