| 1 |
// $Id$
|
| 2 |
|
| 3 |
// Global killswitch: only run if we are in a supported browser.
|
| 4 |
if (Drupal.jsEnabled) {
|
| 5 |
$(document).ready(function(){
|
| 6 |
|
| 7 |
// this is where the selector goes, and then attach a behaviour like on p.218 of learning jQuery
|
| 8 |
var emailLabel = $('#whatcounts-block-form-1 label').remove().text().replace(/: $/,"");
|
| 9 |
|
| 10 |
var emailDefault = $('#edit-email').val();
|
| 11 |
var emailField = $('#edit-email');
|
| 12 |
if (emailDefault == '') {
|
| 13 |
$('#edit-email').addClass('placeholder').val(emailLabel);
|
| 14 |
}
|
| 15 |
$('#edit-email') .focus(function() {
|
| 16 |
if (this.value == emailLabel) {
|
| 17 |
$(this).removeClass('placeholder').val('');
|
| 18 |
};
|
| 19 |
}).blur(function() {
|
| 20 |
if (this.value == '') {
|
| 21 |
$(this).addClass('placeholder').val(emailLabel);
|
| 22 |
}
|
| 23 |
});
|
| 24 |
|
| 25 |
// Empty the placeholder value if it's still there on submit
|
| 26 |
$('#whatcounts-block-form-1').submit(function() {
|
| 27 |
if ($('#edit-email').val() == emailLabel) {
|
| 28 |
$('#edit-email').val('');
|
| 29 |
}
|
| 30 |
});
|
| 31 |
});
|
| 32 |
}
|