I have created a procedure to write content to a text file in my local machine.
<form id="addnew">
<input type="text" class="id">
<input type="text" class="content">
<input type="submit" value="Add">
</form>
<script>
jQuery(function($) {
$('#form_addjts').submit(function(){
writeToFile({
id: $(this).find('.id').val(),
content: $(this).find('.content').val()
});
return false;
});
function writeToFile(data){
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fh = fso.OpenTextFile("D:\\data.txt", 8);
fh.WriteLine(data.id + ',' + data.content);
fh.Close();
}
});
</script>
This is working fine, and able to append my new data to the file.
But I want to update a particular row CONTENT based on the ID which I am passing.
I searched a lot, but could not find any.
How can update a particular row in the file based on the ID?
Note:- I am not using any server as such. I have a a html file (contains all the functionality) which I will be running on my local machine itself.