Your Location is: Home > Jquery

jquery ui auto complete from web sql

From: Sri View: 4985 ANJAN 

Question

I am working in a project HTML with web sql. I am trying to autocomplete a text box from web sql data. But the autocomplete is not working, also no error is showing. Here is my code

<html>
    <head>
        <title>ANJAN</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
        <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/blitzer/jquery-ui.css">
    </head>
<body>
<input type="text"  name="ACC" id="ACC" class="form-control input-sm"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
var ACCAUTO = "";
var db = openDatabase('test', '1.0', 'test', 5 * 1024 * 1024);
$(document).ready(function () {
db.transaction(function (tx) {
                    tx.executeSql('create table if not exists test1(ID integer primary key autoincrement, REF text, DATE date not null, ACC text, ACCTP text, PARTY text, PARTYTP text, AMT DECIMAL(10, 5), REM text, PROJ text)');
                });
db.transaction(function (tx) {
                    tx.executeSql('select * from test1 group by ACC', [], function (tx, results) {
                        var n = results.rows.length;
                        for (var i = 0; i < n; i++) {
                            var x = results.rows.item(i);
                            ACCAUTO += x.ACC + ',';
                        }
                    });
                });
                $("#ACC").autocomplete({
                    source: ACCAUTO
                });
});
</script>
</body>
</html>

Please help me in this regard

Best answer