I've tried re-entering the code several times over, and even tried copy-pasting it directly from an earlier post by Imar. This is how I have my code looks:
Code:
<script type="text/javascript">
$(function()
{
$(':input[type=text], textarea').each
(
function()
{
var newText = 'Please enter your ' + $(this).parent().prev().text().toLowerCase().trim();
$(this).attr('value', newText);
}).one('focus', function()
{
this.value = '', this.className = ''
}).addClass('Watermark').css('width', '300px');
});
</script>
The trouble does not seem to be with typos, but that jQuery, or maybe at least Intellisense, don't agree with this codeblock.
in the line $(this).parent().prev().text(),
.toLowercase() doesn't show up in Intellisense.
inside of the .one('focus', function(){,
this does not have the .value or .className methods in Intellisense
Additionally, in the section Miscellaneous jQuery Functionality, I was never able to get the .innerHTML property.
I'm using the copy of jQuery from the code download, jquery-1.4.1.min.
js, and I'm using Visual Studio 2010.