Click here to Skip to main content
14,325,789 members
Rate this:
Please Sign up or sign in to vote.
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:
<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:

<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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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

<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:
<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>
   
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100