2
I have a form
with a textarea
, put a placeholder us input
and is working perfectly, except in the textearea
.
<form name="trabalheConoscoFormulario" id="trabalheConoscoFormulario" action="" method="post" onsubmit="return trabalheConoscoForm();">
<div class="grid_210 f-left">
<input type="text" placeholder="nome*" />
<input type="text" placeholder="e-mail*" />
<input type="text" placeholder="telefone" />
<input class="grid_150 f-left" type="text" placeholder="cidade" />
<input class="grid_55 f-right" type="text" placeholder="UF" />
<div class="clear"></div>
<div class="flechaPreta flechaBrancaTrabalhe margin-top-10 cp"></div>
</div>
<div class="grid_210 f-right">
<div class="trabalheConoscoAnexo cp">anexar currículo</div>
<input style="display:none" type="file" class="trabalheConoscoAnexoInput" id="curriculoForm" name="curriculoForm" value="" />
<textarea type="text" id="trabalheConoscoObs" name="trabalheConoscoObs" placeholder="observações">observações</textarea>
</div>
</form>
Jquery:
function add() {
if ($(this).val() == '') {
$(this).val($(this).attr('placeholder')).addClass('placeholder');
}
}
function remove() {
if ($(this).val() == $(this).attr('placeholder')) {
$(this).val('').removeClass('placeholder');
}
}
if (!('placeholder' in $('<input>')[0])) { // Create a dummy element for feature detection
$('input[placeholder], textarea[placeholder]').blur(add).focus(remove).each(add);
$('form').submit(function () {
$(this).find('input[placeholder], textarea[placeholder]').each(remove);
});
}
What is wrong?
It wouldn’t be because you have a text already pre-typed inside your
<textarea>
?<textarea type="text" id="trabalheConoscoObs" name="trabalheConoscoObs" placeholder="observações">
observações</textarea>
haha :)– Paulo Roberto Rosa
CARACA @Pauloroberto as I did not see it! ahahaah was worth
– Felipe Viero Goulart