Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello Everyone,
I am facing a problem only on some systems not no all. i have a input type=text with list attribute. here is code:
C#
<input type="text" name="txtUserId" id="txtUserId" list="UID" autocomplete="off" class="form-control">
     <datalist id="UID"></datalist>

in this datalist i load data and when i start type in textbox then this datalist render. it works fine
but on some system in chrome it not showing. i inspect the page and saw data is loaded but not shown. on that system the version of chrome is 50.0.2661.75. I googled a lot but not found any solution. how i resolve this.

Thanks

What I have tried:

C#
<input type="text" name="txtUserId" id="txtUserId" list="UID" autocomplete="off" class="form-control">
     <datalist id="UID"></datalist>
Posted
Updated 29-Jun-16 1:11am
v3

1 solution

I found solution. i have removed datalist and add autocomplete function of jquery on textbox. which works fine on all systems for me.

HTML
<input type="text" name="txtUserId" id="txtUserId" list="UID" autocomplete="off" class="form-control">  

Here is Jquey function: 
  $("#txtUserId").autocomplete({
                source: function (request, response) {
                    var p_length = $("#txtPincode").val();
                    if (p_length.length < 14) {
                        $.ajax({
                            url: "/MapSearch/LoadAll_Pcode",
                            type: "POST",
                            dataType: "json",
                            data: { txt: request.term },
                            success: function (data) {
                                var val_sn = $.map(data, function (snm) {
                                    var txt1 = request.term.substring(request.term.lastIndexOf(",")+1, request.term.lastIndexOf(",") + 5)
                                   if (snm.Text.toUpperCase().indexOf(txt1.toUpperCase()) === 0) {
                                        return snm.Text;
                                    }
                                });
                                response(val_sn);
                            },
                            error: function (data) {

                            }
                        });
                    }
                },              
                minLength: 1,
            });

please add these two links on your page:
HTML
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900