Sha256: 78d20316e6725296de26ae5fb2446c0344b5b94a4997a66e96649a0d6f623496

Contents?: true

Size: 1022 Bytes

Versions: 4

Compression:

Stored size: 1022 Bytes

Contents

(function($){
  $("input[placeholder], textarea[placeholder]").each(function(){
    var that = this;
    if (hasClass(document.documentElement, 'ie') && that.placeholder && 'placeholder' in document.createElement(that.tagName)) return;
    var placeholder = that.getAttribute('placeholder'),
        input = $(that),
        placeholderClass = 'text-placeholder';
    if (that.value === '' || that.value == placeholder) {
      input.addClass(placeholderClass);
      that.value = placeholder;
    }
    input
    .focus(function(){
      if (input.hasClass(placeholderClass)) {
        this.value = '';
        input.removeClass(placeholderClass);
      }
    })
    .blur(function(){
      if (this.value === '') {
        input.addClass(placeholderClass);
        this.value = placeholder;
      } else {
        input.removeClass(placeholderClass);
      }
    });
    that.form && jQuery(that.form).submit(function(){
      if (input.hasClass(placeholderClass)) {
        that.value = '';
      }
    });
  });
})($);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtpl-compass-1.4 templates/project/js/full/ph.js
rtpl-compass-1.3 templates/project/js/full/ph.js
rtpl-compass-1.2 templates/project/js/full/ph.js
rtpl-compass-1.0 templates/project/js/full/ph.js