<span>Product:</span>
<input type="text" name="product" class="form-control input-sm">
<span>Code:</span>
<input type="text" name="code" class="form-control input-sm">
**<span>Min Price:</span>
<input type="text" name="price" class="form-control input-sm">**
如何搜索输入中的价格范围,如0-100 100-500 500-1000或使用选择。
$(document).ready(function() {
// Map inputs with columns (nth-child(X))
var inputMapper = {
"product": 1,
"code": 2,
"price": 3
};
$("input").on("input", function() {
var $this = $(this);
var val = $this.val();
var key = $this.attr("name");
dtInstance.columns(inputMapper[key] - 1).search(val).draw();
});
});