Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions jquery.dynatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
paginationPrev: 'Previous',
paginationNext: 'Next',
paginationGap: [1,2,2,1],
searchAutofocus: false, // note: won't work in all browsers (esp. mobile)
searchTarget: null,
searchPlacement: 'before',
searchText: 'Search: ',
Expand Down Expand Up @@ -1254,6 +1255,10 @@
text: settings.inputs.searchText
}).append($search);

if (settings.inputs.searchAutofocus) {
$($search).attr('autofocus', 'autofocus');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using jQuery, we would generally use the prop function rather than the attr function for this. Also, the $search element is already a jQuery element, so it doesn't need to be re-wrapped. Probably instead use something like:

$search.prop('autofocus', true)

}

$search
.bind(settings.inputs.queryEvent, function() {
obj.queries.runSearch($(this).val());
Expand Down