带有搜索过滤器Codeigniter的复选框 [英] Checkbox with search filter codeigniter
本文介绍了带有搜索过滤器Codeigniter的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是,当我选中其中一个复选框然后进行搜索时,该复选框将变为取消选中状态.而且我不知道我的实时搜索有什么问题,它没有用.请检查此链接进行测试.
My problem is when I check one of the checkboxs and then I search it, the checkbox will change to uncheck. and I don`t know what's wrong with my livesearch, it is not working. please check this link to test.
http://jsfiddle.net/v921/KmVHf/4/
是我的JavaScript
is is my javascript
var tr = $(".AvailableGroupLab").clone().html();
function filter(element) {
$('.AvailableGroupLab').html(tr);
var value = $(element).val().toLowerCase();
$(".AvailableGroupLab tr").each(function () {
if ($(this).text().toLowerCase().search(value) == -1){
$(this).remove();
}
});
}
推荐答案
尝试
function filter(element) {
var $trs = $('.AvailableGroupLab tr').hide();
var regexp = new RegExp($(element).val(), 'i');
var $valid = $trs.filter(function () {
return regexp.test($(this).children(':nth-child(2)').text())
}).show();
$trs.not($valid).hide()
}
$('input:text').on('keyup change', function () {
filter(this);
})
演示:小提琴
这篇关于带有搜索过滤器Codeigniter的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文