Answer the question
In order to leave comments, you need to log in
How to interact with files in JavaScript?
How to make it so that when you click on a button on the site, using JS , a new text file is created, for example test.txt , and you can change the text in it, and later also get values from this file?
Ps - if possible, please explain in more detail how this is implemented and how to do it in my case, maybe I need to connect a new library? I have searched everywhere on the Internet, so I am writing here. I need to be sure without the intervention of php . My project is specially made statically - no databases and servers. Thanks in advance.
<!DOCTYPE html>
<html lang="en">
<head>
<script src="js/jquery.js"></script>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="block_content">
<button class="btnCreateNewFile">Создать файл</button>
</div>
<script>
$(".btnCreateNewFile").click(function()
{
// Здесь происходит создание файла с помощью js либо JQuery...
});
</script>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
yes, you just
don't need to write a file. We write data to Localstorage and, if necessary, throw it on the back, which validates and writes the database
Read here.
Server - not needed at all: just set the flag you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question