Can anyone please help correct some Javascipt? This particular script is not in the download.... it is in Chapter 11.
When I run the script, I get:
Error: '$' is undefined in the browser. (How can it be undefined??)
The code is below and seems identical to the code in the book - but I am willing to bet it has a glitch I have not found yet.
Code:
<%--Java Script to apply Watermark --%>
<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>