Utilizing local storage for the functionality of my Save Button

My innovative program features a drag-and-drop functionality for assigning players to different teams. If 'Player A' is dragged into the 'Team D' column, I am looking for ways to manipulate localStorage or any other function to save the team assignment when the 'Save' button at the bottom is clicked.

Note: The code snippet provided here may not work directly. It needs to be copied and saved as an HTML file to run successfully on your browser.

...

Answer №1

If you're looking for a solution, consider using "Web SQL"

Here is a brief overview of how "Web SQL" can be utilized:

var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);
db.transaction(function(tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS players (id unique, text)');
    tx.executeSql('INSERT INTO players (id, text) VALUES (1, "A")');
    tx.executeSql('SELECT * FROM players', [], function(tx, results) {
        var len = results.rows.length;
        for (var i = 0; i < len; i++) {
            alert(results.rows.item(i).text);
        }
    });
});

For an in-depth tutorial on utilizing "Web SQL," visit this resource

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Developing Paid Node Modules: A Step-By-Step Guide

Looking to monetize node modules? Interested in releasing your CMS plugins on NPM and offering some as paid options for users to install? Wondering how to go about it? ...

Sending Multiple PHP Variables via Ajax to PHP Processor

Looking for advice on the best method to pass multiple PHP variables (or database table fields) through Ajax to my handler from a <span> element functioning as an icon. Any assistance is greatly appreciated! TABLE art_id art_title art_company ...

Looking to implement a Javascript AJAX queue system for handling cross-domain JSONP requests. Seeking guidance on how to effectively accomplish this

I have a JavaScript code that I need to convert into a queue system. Currently, the code looks messy with long chains of requests being made in a specific order. Please note that my function requests return JSON objects and setting async to false is not an ...

Activate the typeahead feature in ng-bootstrap 4 by setting it to open when the

I am currently using ng-bootstrap 4 (beta 8) and have the following setup: <ng-template #rt let-r="result" let-t="term"> {{ r.label }} </ng-template> <input id="typeahead-focus" class="form-control" [(ngModel)]= ...

Retrieve input value from a jQuery template

I've created a template <div id="template" style="display: none;"> <strong>Name</strong>: <span class="name"></span><br/> <input type="number" id="amount"> <button type="button" onclick="App.submit ...

Change the runat attribute in JavaScript to execute on the server side

Is there a way to dynamically set the runat attribute using client-side JavaScript? I am facing the challenge of adding rows to a table after the page is loaded and must ensure that their cell data is accessible on the server side. While I am open to marki ...

Exploring the world of Kendo Charts Linear Gauge with a Decim

Need help adjusting decimal scales for Linear Gauge in kendo Charts... Check out the Fiddle here function createGauge() { $("#gauge").kendoLinearGauge({ pointer: { value: 0.5, size: 15, shape: "arrow" ...

Exploring the art of manipulating HTML code using JavaScript

I am looking to implement a specific change using JavaScript: <input id="innn" value="" /> to: <input id="innn" value="SOME_VALUE" /> I attempted the following methods: document.getElementById("innn").setAttribute("value", "189"); and als ...

Is it possible to create and view HTML files in Objective C through user interaction?

I am currently working on developing an iOS app that enables users to create an unlimited number of HTML documents and save them within the app's documents folder. It's somewhat of a combination question, but how can I showcase a file that is sto ...

Create a scrollable Bootstrap table without impacting the layout grid system

Is there a way to create a scrollable table without impacting the grid system layout? How do I make a table scrollable while keeping the col-xs tag intact? <table class="col-xs-12"> <thead> <th class="c ...

Navigating to various controller bases depending on the type of route value in a node.js application: How is it

As I work on organizing my URLs, I have implemented a consistent pattern for my routes. Below are the routes I've set up: app.route('/inbox') .get(user.inbox); app.route('/:messageId') .get(user.message); I am looking f ...

What is the best method for retaining the complete YQL outcome within a JavaScript object?

I am trying to store the output of my YQL Query in a JavaScript object Here is my query: SELECT * FROM html WHERE url="http://myurl.com" and xpath="/html/body/center/table[1]/tr" Can someone guide me on how to proceed? I have gone through the YQL docu ...

javascript mobile nav event

My website utilizes a bootstrap feature for mobile devices where a left sidebar pops up when clicking a button. I am not very familiar with bootstrap, but I would like to link a javascript event to determine if the left sidebar is visible. How can I achiev ...

Managing collapsible content in Bootstrap 4: A comprehensive guide

How can I customize collapsible content in Bootstrap 4? For instance, take a look at this navbar: https://i.sstatic.net/UYbMQ.png https://i.sstatic.net/OuVdw.png https://i.sstatic.net/lXvYt.png I'm looking to modify the behavior of this example. ...

The series attribute cannot be located within the reactD3Basic object in ReactD3

Recently, I attempted to integrate the reactd3 library into my project and encountered an issue: Uncaught TypeError: (0 , _reactD3Basic.series) is not a function This error is specifically pointing to this line in the library code: var chartSeriesData = ...

Unable to load XML in Chrome using JQuery

Can anyone explain why the code below works in Firefox but not Chrome? I'm currently testing it on my local machine. Thanks for any insights you can provide! <html> <head> <script type="text/javascript" src="jquery.js"> ...

What is the best way to implement a useState within a context for testing with jest?

function CustomComponent() { const {val, change} = useContext(ProviderContext) return ( <TextField> onChange={({target}) => { change(target) }} value={val} </TextField> ); } describe('test', ( ...

Trouble with AJAX functionality triggering on page load but failing to work on button click

After experimenting with ajax for some time to retrieve data from a database, I finally managed to get it working in my test file. Encouraged by this success, I proceeded to copy the code into my main file. Initially, everything seemed to be functioning co ...

Issues with form submission functionality

My code seems to be working fine, as I am able to see data in the console. However, the information is not being added to the database. I suspect that the issue lies with the condition in the process.php file for action: add_new, but I'm not certain. ...

Issue with updating Leaflet map within Bootstrap 4 tabs

Here is an issue I am facing in my project. I am currently working on a Bootstrap 4 page that has multiple tabs. Each tab contains a leaflet map, dygraphs, and other content. The problem arises when I switch between tabs, the map does not reload properly ...