javascript - How to add lang attribute to DataTables.js search box -
i using jquery plugin needs add attribute inputs in page.
$("input").attr('lang', 'fa');
i have no problem adding inputs except datatables search box code doesn't affect.
i tried code doesn't work:
$(document).ready(function () { var table = $('#orderstable').datatable(); $('.datatables_filter input').attr('lang','fa'); $("input").attr('lang', 'fa'); });
edit:
tried many things problem still exists. see problem @ this link , type numbers in search box , input box @ bottom of page.
cause
datatables uses <input type="search">
search box. reason applying lang
attribute doesn't have effect on input type.
solution
changing input type <input type="text">
fixes issue.
$('#example').datatable(); $('.datatables_filter input').attr({'lang': 'fa', 'type': 'text'});
demo
see jsfiddle code , demonstration.
Comments
Post a Comment