Skip to content

Instantly share code, notes, and snippets.

@Shpigford
Created June 18, 2012 21:16
Show Gist options
  • Save Shpigford/2950781 to your computer and use it in GitHub Desktop.
Save Shpigford/2950781 to your computer and use it in GitHub Desktop.
$.fn.fauxPlaceholder = function(){
return this.each(function(){
$(this)
.click(function(){
$(this).find("label").hide();
$(this).find('input').focus();
}).find("input").focus(function(){
$(this).prev('label').hide();
}).blur(function(){
if (!$(this).val()){
$(this).prev('label').show();
}
})
});
}
$('.tracking_single_number p').fauxPlaceholder();
$('.tracking_single_number p input').focus(function(){
$(this).parents('form').addClass('selected');
$(this).parents('form').children('.note').removeClass('hidden');
if ($('.overlay').length <= 0){
$('body').prepend('<div class="overlay"></div>');
}
});
$('.overlay').live(click_event,function(){
$(this).remove();
$('.tracking_single_number').removeClass('selected');
$('.tracking_single_number').children('.note').addClass('hidden');
$('#listing article header .actions').hide();
$('#listing article header .current').show();
});
$('.tracking_single_number p input').keyup(function(event) {
if (event.keyCode == 13) {
this.form.submit();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment