jquery - Autocomplete is not working and no dropdownlist appears -
i using script written below autocomplete. working when add jquery-1.8.3.js in master page, when remove master page , add specific page, stops working. don't know why causing problem.
<script type="text/javascript"> function pageload(sender, args) { $(function () { $(".tb").autocomplete({ source: function (request, response) { $.ajax({ url: "autoinsurancecompanylist.asmx/fetchcompanylist", data: "{ 'cmp': '" + request.term + "' }", datatype: "json", type: "post", contenttype: "application/json; charset=utf-8", datafilter: function (data) { return data; }, success: function (data) { response($.map(data.d, function (item) { return { value: item.insco } })) }, error: function (xmlhttprequest, textstatus, errorthrown) { alert(textstatus); } }); }, minlength: 1 }); }); } </script> <asp:updatepanel id="updatepanel3" updatemode="conditional" visible="true" rendermode="inline"runat="server"> <contenttemplate> <ul class="formlist"> <li class="clear"> <label> insurance company:</label> <asp:textbox id="txtinsurancecompany" class="tb" runat="server" maxlength="40"></asp:textbox> <asp:requiredfieldvalidator id="requiredfieldvalidator33" runat="server" controltovalidate="txtinsurancecompany" errormessage="please enter insurance company name" forecolor="red" setfocusonerror="true"></asp:requiredfieldvalidator> </li> </ul> </contenttemplate> </asp:updatepanel>
at runtime in browser shows
<input id="contentplaceholder1_txtinsurancecompany" class="tb ac_input" type="text" autocomplete="off" maxlength="40" name="ctl00$contentplaceholder1$txtinsurancecompany">
please help
try this
<script type="text/javascript"> jquery.noconflict(); jquery(document).ready(function () { var availabletags = array(); jquery.ajax({ url: "autoinsurancecompanylist.asmx/fetchcompanylist", data: "{ 'cmp': '" + request.term + "' }", datatype: "json", type: "post", contenttype: "application/json; charset=utf-8", datafilter: function (data) { return data; }, success: function (data) { $.map(data.d, function (item) { availabletags.push(item.insco); }) }, error: function (xmlhttprequest, textstatus, errorthrown) { alert(textstatus); } }); jquery(".tb").autocomplete({ source: availabletags }); }) </script>
Comments
Post a Comment