Skip to content

Instantly share code, notes, and snippets.

@lidplussdesign
Created August 23, 2014 15:57
Show Gist options
  • Save lidplussdesign/490d40d68efe7889cc18 to your computer and use it in GitHub Desktop.
Save lidplussdesign/490d40d68efe7889cc18 to your computer and use it in GitHub Desktop.
456shop v1.1 - Product post, review button issue
/*global $:false */
$(document).ready(function(){
"use strict";
// contact form 7 plugin
// clear input on focus
$('.wpcf7-text').focus(function(){
if($(this).val()===this.defaultValue){
$(this).val('');
}
});
// if field is empty afterward, add text again
$('.wpcf7-text').blur(function(){
if($(this).val()===''){
$(this).val(this.defaultValue);
}
});
// comment form
// clear input on focus
$('.single-post #commentform input').focus(function(){
if($(this).val()===this.defaultValue){
$(this).val('');
}
});
// if field is empty afterward, add text again
$('.single-post #commentform input').blur(function(){
if($(this).val()===''){
$(this).val(this.defaultValue);
}
});
// clear input on focus
$('#commentform textarea').focus(function(){
if($(this).val()===this.defaultValue){
$(this).val('');
}
});
// if field is empty afterward, add text again
$('#commentform textarea').blur(function(){
if($(this).val()===''){
$(this).val(this.defaultValue);
}
});
// if field is empty afterward, add text again
$('#pmc_mailchimp input[type="text"]').blur(function(){
if($(this).val()===''){
$(this).val(this.defaultValue);
}
});
// clear input on focus
$('#pmc_mailchimp input[type="text"]').focus(function(){
if($(this).val()===this.defaultValue){
$(this).val('');
}
});
// if field is empty afterward, add text again
$('#pmc_mailchimp input[type="text"]').blur(function(){
if($(this).val()===''){
$(this).val(this.defaultValue);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment