I have a page that is displaying multiple forms each with the same fields. The number of forms generated depends on how many videos show up on their page. I want to by default display "Enter Email Address" in each input field, and when the user clicks on it - remove the text, and when they blur from it - show the text again. I can get it working for the first field, but not for any after that. Does anyone have any ideas?
<script>
$(document).ready(function() {
$('#email').each(function() {
$(this).click(function() {
if (this.value == this.defaultValue) {
this.value = '';
}
});
$(this).blur(function() {
if (this.value == '') {
this.value = this.defaultValue;
}
});
});
})
</script>
<form id="share" name="share" method="post" action="">
<span style="font-weight: bold">Share This Video:</span>
<input id="email" name="email" type="text" value="Enter Email Address">
<input id="video" name="video" type="hidden" value="<?=$filmId?>">
<input id="submit" name="submit" type="submit" value="Share">
</form>
Note: the form above is only displayed here once for space reasons, but it can be displayed up to 5 times.