(function($) {
customStyle = {
create: function(name) {
var stylesheet;
if(!(stylesheet = document.styleSheets[name])) {
$('head').prepend($(''));
if(!document.styleSheets[name]) {
document.styleSheets[name] = document.styleSheets[0];
}
stylesheet = document.styleSheets[name];
stylesheet.add = function(selector, rules) {
var stylesheet = this;
if(stylesheet.addRule) {
for(var i=0, l=selector.length;i', { text:text, value:'', 'class':'rmi-placeholder' });
$this.prepend(op);
});
$('input[name=Address], input[name=address]').each(function() {
var $this = $(this);
var newInput = $this.clone().attr('name', 'address1')
.attr('id', 'address1')
.data('org-input', this)
.on('change', function() {
$(this).data('org-input').value = this.value;
});
newInput.insertAfter($this);
//.attr('type', 'hidden')
$this.removeAttr('placeholder')
.hide().appendTo($this.closest('form'));
});
if(!supportsPlaceholder) {
$('form input[placeholder]').each(function() {
var $this = $(this);
var text = $this.attr('placeholder');
var container = $('
').insertBefore($this);
var ph = $("").html(text);
if($this.val()) { ph.hidePlaceholder(); }
container.append(ph).append($this);
});
window.onChange = function(e) {
console.log(e);
$('form input[placeholder]').trigger('focus');
};
}
}).on('click', 'span.rmi-placeholder', function(e) {
$(this).addClass('rmi-placeholder-hidden')
.next('input').focus();
}).on('focus blur', 'input[placeholder]', function(e) {
var $this = $(this);
var ph = $this.prev('span.rmi-placeholder');
switch(e.type) {
case 'focusin':
ph.addClass('rmi-placeholder-hidden');
break;
case 'focusout':
if(!$this.val()) { ph.removeClass('rmi-placeholder-hidden'); }
break;
}
}).on('change', 'select[placeholder]', function() {
var $this = $(this);
if($this.val()) {
$this.removeClass('rmi-placeholder');
} else {
$this.addClass('rmi-placeholder');
}
});
})(jQuery);