Para adicionar novos inputs, inclua no objeto _input_info o ID e o texto do placeholder
Exemplo funcional: http://codepen.io/anon/pen/DCnKI
<input type="text" id="cp_bairro" /> | |
<input type="text" id="cp_rua" /> | |
<input type="text" id="cp_cep" /> |
(function( $, undefined ) { | |
'use strict'; | |
var place = (function() { | |
return { | |
_input_info : [ | |
{ | |
id : 'cp_bairro', | |
text : 'Preencha o bairro' | |
},{ | |
id : 'cp_rua', | |
text : 'Preencha a rua' | |
},{ | |
id : 'cp_cep', | |
text : 'Preencha o CEP' | |
} | |
], // input_info | |
init : function() { | |
this.add_placeholder( this._input_info ); | |
}, // init | |
add_placeholder : function( info ) { | |
var amount_inputs = info.length; | |
for( var i = amount_inputs; i--; ) { | |
$( '#' + info[i].id ).attr( 'placeholder', info[i].text ); | |
} | |
} // add_placeholder | |
}; // return | |
})(); | |
// DOM Ready | |
$(function() { | |
place.init(); | |
}); | |
})( jQuery ); |
Para adicionar novos inputs, inclua no objeto _input_info o ID e o texto do placeholder
Exemplo funcional: http://codepen.io/anon/pen/DCnKI