From 10c15790e9dd2bb4a1f54883744976caea48d871 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 20 Feb 2014 13:44:33 -0600 Subject: [PATCH 1/2] Added option to autofocus search field --- jquery.dynatable.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jquery.dynatable.js b/jquery.dynatable.js index d08aba3..d255f6e 100644 --- a/jquery.dynatable.js +++ b/jquery.dynatable.js @@ -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: ', @@ -1254,6 +1255,10 @@ text: settings.inputs.searchText }).append($search); + if (settings.inputs.searchAutofocus) { + $($search).attr('autofocus', 'autofocus'); + } + $search .bind(settings.inputs.queryEvent, function() { obj.queries.runSearch($(this).val()); From e65468f09dd454097b17ba3c761b1c6966e2deac Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 22 Nov 2015 11:12:10 -0600 Subject: [PATCH 2/2] Use autofocus property instead of attribute --- jquery.dynatable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.dynatable.js b/jquery.dynatable.js index d255f6e..d9a3d1b 100644 --- a/jquery.dynatable.js +++ b/jquery.dynatable.js @@ -1256,7 +1256,7 @@ }).append($search); if (settings.inputs.searchAutofocus) { - $($search).attr('autofocus', 'autofocus'); + $search.prop('autofocus', true); } $search