Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:39:20+00:00 2026-06-14T13:39:20+00:00

Hey so I have a text area in my HTML and whenever I you

  • 0

Hey so I have a text area in my HTML and whenever I you click on a file name in the list it puts the contents of the file in that text area, it works great clicking back and forth between files. As soon as i edit something within the textarea then go try to click the file names again it just doesn’t do anything or update that text area anymore.

<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>

var currentFile;



$(document).ready(function()
{
var request = new XMLHttpRequest();
request.open("GET", "getFiles.php", false);
request.send();
var result = request.responseText;
$("#fileNames").html(request.responseText);
});



$(document).ready(function()
{
$("li").click(function()
{
    currentFile = $(this).text();
    $("#currentFile").text(currentFile);

    var request = new XMLHttpRequest();
    request.open("GET", "getFileContents.php?fileName="+currentFile, false);
    request.send();
    var result = request.responseText;
    $("#fileContents").text(result);
});
 });



function saveFile()
{
var request = new XMLHttpRequest();
var contents = $("#fileContents").text();
request.open("GET", "saveFile.php?fileName="+currentFile+"&fileContents="+contents, false);
request.send();
}


</script>


<style type="text/css">

ul.fileList li
{
    background-color:blue;
}


#fileContents
{
    resize: none;
}

 </style>


</head>
<body>
<div id="currentFile">No File Selected</div

<br />

<ul id="fileNames" class="fileList">

</ul>

<br />

<textarea id="fileContents" cols="25" rows="5">No Contents</textarea>
<input type="button" onclick="saveFile();" value="Save" />

</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:39:21+00:00Added an answer on June 14, 2026 at 1:39 pm

    You should use .val() to get and set the text in a textarea

    $("#fileContents").val(result);
    
    var contents = $("#fileContents").val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, I have Arabic text in a txt file that I would like to
Hey, I have some text that is formatted like this: [quote]foo text[/quote] and I
I have a text file that looks similar to; section header 1: some words
hey guys I have the follow code in js: $(document).ready(function(){ $(.replyLink).click(function(){ $(#form-to-+this.id).html(htmlForm()).toggle(500); return false;
Hey all, I have a basic HTML contact form that goes to a .php
hey i have text file shown as below. 11/2/2010     cat    6 11/2/2010   
hey guys I have a problem adding text inside an added html-tag I have
Hey everybody, this is what I have going on. I have two text files.
Hey I have a really annoying IE7 bug that I am trying to work
hey i have a counter text here and i need to know how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.