jeudi 11 novembre 2021

PHP - Changing this code to select a CSV cell randomly instead

So I have a search field that searches a CSV file column as you type. What I'd like is a button (or another simple way) of selecting a random cell from this column instead.

The webpage it's currently on is www.eurolinkva.uk/flight_search.php (if that helps)

The code that seems to govern a specific search field is as below:

this.api().columns([1]).every(function(e) {
                    var column = this;
                    $("#di").html('');
                    var text = $(
                            '<input type="text" placeholder="" class="form-control" style="text-transform:uppercase"/>')
                        .appendTo($("#di"))
                        .on('keyup change click', function() {
                            var val = $.fn.dataTable.util.escapeRegex(
                                $(this).val()
                            );
                            column
                                .search(val)
                                .draw();
                        });
                });

I'm afraid to say I'm still very new to coding and this particular problem is beyond my ability. Any help getting this going would mean the world. Please treat my like an idiot though so I don't get too confused haha

Thanks!




Aucun commentaire:

Enregistrer un commentaire