/*
* author: mihail-174
* v2.0.1
* github: https://github.com/mihail-174
* Плейсхолдер на всех текстовых полях форм из label
*
* USED:
* $('class_формы').placeholder_wf();
*
* Параметры по умолчанию:
* field: 'wf__field' — класс обертки полей
*/
$.fn.placeholder_wf = function(options) {
var elem = this;
options = $.extend({
field: 'wf__field'
}, options);
return this.each(function() {
$(elem).find('.' + options.field).each(function(){
var placeholder = $(this).find('label').text();
if ( $(this).find('input').val() == '' ) {
$(this).find("input").attr("placeholder", placeholder).val('');
}
if ( $(this).find('textarea').text() == '' ) {
$(this).find("textarea").attr("placeholder", placeholder).val('');
}
});
});
}