As MrN00b noted, I am assuming you have left out the inclusion of the jQuery js file itself? Please include it, if you have not already, as it is not implicitly part of a web page.
As your code precedes the item in the document it references (id="text")
, you need to wait for the document to complete loading:
Use one of these so that your jQuery will wait for the DOM to finish loading:
Traditional:
$(document).ready(function(){
$('#text').load("/textdoc.txt");
});
Shortcut:
$(function(){
$('#text').load("/textdoc.txt");
});
Safe (locally scoped $):
jQuery(function($){
$('#text').load("/textdoc.txt");
});