search need to target by particular class name

search need to target by particular class name

muakomuako Posts: 9Questions: 1Answers: 0
edited September 2021 in Free community support

.search how to target by specific class name? My td has multiple span tag but i would like to target one tag as myTarget, so Manager will be filtered.

$('#example').DataTable( {                
                var column = this;               
                   $('.dropdown_class') .on( 'change', function () {
                        var val = $.fn.dataTable.util.escapeRegex(
                            $(this).val()
                        ); 
                        column.search( val ? '^'+val+'$' : '', true, false ).draw();
                    } );
            } );      
    } );

When i am using above method, its conflict and its not match between td because td match newline or separate word.

Example:

<tr>
<td>Garrett Winters</td>
<td>Director <span class="myTarget">Manager</span><span class="noTarget">Officer</span></td>
<td>Edinburgh</td>
<td>63</td>
<td>2011/07/25</td>
<td>$5,300</td>
1.</tr>

Replies

Sign In or Register to comment.