You have two issues in your code that I noticed. As mentioned in the comments, clicking a link will open that link.
And as one of the answers by Adil mentioned, you can access the link's href
by using JQuery attr
$("#loadText").attr("href");
or DOM attr
var a = document.getElementById("loadText");
a.href;
Secondly, to prevent the page from opening the file/redirecting to the file, one way is to change the href attribute of the link and add the real file address to a different attribute of your own choice.
//now href will not redirect your page to anywhere, it will just append some text to the url.
<a href="#loadText" addref="Writings/test.txt" class="textlink">test</a>
$(document).ready(function () {
$("a.textlink").click(function () {
$("#WritingContent").load($(this).attr("addref")) //accessing addref instead of href
});
});
Another way is to keep the link as it as with it's original href but prevent redirecting/opening the file on link click
$(document).ready(function () {
$("a.textlink").click(function (e) {
e.preventDefault();//here we prevent the link from doing it's what it was meant to do, linking!
$("#WritingContent").load($(this).attr("href"))
});
});