Solution:
If your using WordPress, I recommend writing your script more like this:
jQuery(document).ready(function(){
jQuery('#edValue').keypress(function(){
edValue = jQuery("#edValue").val();
jQuery("#lblValue").html("The text box contains: " + edValue);
});
});
The reason is that the particular copy of jQuery used in wordpress’s wp_enqueue_script
function is, by default, in compatibility mode. Which pretty much means that the usual $
shortcut for jQuery doesn’t work and should be replaced with jQuery
instead.
And then you can change your HTML to something like this:
<input id="edValue" type="text"><br>
<span id="lblValue">The text box contains: </span>