i'm trying make search option in popover.
i load these popovers using ajax page.
my popover code:
$(function () { $('body').on('click','.popup1',function(){ var windowid = this.id; $(".popup1").popover({ title: "kies product", content: '<input type="text"class="form-control" id="search" name="productsearch" autocomplete="off" /><div id="searchable" class="list-group" style="margin-bottom: 0px;><div class="personscroll"><?php foreach($products $d):?><a id="' + windowid + '" class="list-group-item" onclick="sending1(<?=$d->productid?>,this.id);" href="javascript:;"><?=$d->titel?></a><?php endforeach;?></div>', html: true, trigger: 'manual', placement: "top", template: '<div class="popover personchoose"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>' }); $(this).popover('toggle'); $(".popup1").on('shown.bs.popover', function (e) { search(); $(".hideable").not(e.target).popover("hide"); }); }); });
my search function:
function search() { var $rows = $('#searchable div a'); $('#search').keyup(function () { var val = $.trim($(this).val()).replace(/ +/g, ' ').tolowercase(); $rows.show().filter(function () { var text = $(this).text().replace(/\s+/g, ' ').tolowercase(); return !~text.indexof(val); }).hide(); }); }; it can't find rows , , don't know why. can me fixing method or giving other option?
tnx.
Comments
Post a Comment