I want to make autoserch where I add li tag to ul tag My Code is <pre lang="HTML"> <div class="row clearfix"> <div class="col-md-11"> <div class="form-group"> <b> <asp:Label ID="lblTagRegisteredUsers" runat="server" Text="FPS"></asp:Label> <i class="fa text-red">*</i></b> <div id="lblProcessingTagFPS" class="pull-right" style="display: none;" ><i class="fa fa-refresh fa-spin"></i></div> <ul id="dvTag" runat="server" name="dvTag" ></ul> <b></b> </div> </div> </pre> My javascript function is, for making li tag <pre lang="Javascript"> $('#dvTag').tagit({ triggerKeys: ['comma', 'enter', 'space', 'semicolon'], placeholder: 'Enter FPS Code OR Name...', tagSource: function (request, response) { //alert("yes"); var alloc = $('#ContentPlaceHolder1_ddlA :selected').text(); var tehsil = $('#ContentPlaceHolder1_ddlT :selected').val(); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "../scm/Search_CS.ashx?act=ul&f=" + request.term + "&alloc=" + alloc + "&tehsil=" + tehsil, data: "{}", dataType: "json", async: true, beforeSend: function () { $('#lblProcessingTagFPS').show(); }, complete: function (xhr, textStatus) { $('#lblProcessingTagFPS').hide(); }, success: function (data) { mydata = new Array(); for (var i = 0; i < data.length; i++) { mydata.push({ label: data[i].FPS_ShopName_EN, value: data[i].FPSCode }); } //setup the search to search the label and the description var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); response($.grep(mydata, function (value) { return matcher.test(value.label) || matcher.test(value.desc); })); } }); } });</pre> When I add li tag it contains div and a tag. Now I want to remove all li tag from ul tag in jquery on selection index change. My jquery code is <pre lang="Javascript">function RemoveList() { $('#dvTag').each(function () { var elem = $('#dvTag'); if (elem.children().length > 1) { elem.children().remove(); } } ); }</pre> It is working but after removing li tag ,again I type text for autoserch, method in Search_CS.ashx reteun suggested list but on gui ,it is not show list that is why i can select tag.
return matcher.test(value.label);//this line is not working after removing li tag in RemoveList by elem.children().remove();
function RemoveList(){ $("#ulelementID").html(""); }
RemoveList() $('#dvTagFPS').tagit("reset");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)