qadenza
qadenza

Reputation: 9293

How to change placeholder for an textarea?

This code submits a form and it works, except changing placeholder for textarea id=message

$('#submit').click(function(){
   $.post("mail.php", $("#contact").serialize(), function(response) {
   $('#message').attr('placeholder', response);
   $('#success').html(response);
   });
}); 

There is no error in Firebug.

Upvotes: 2

Views: 3519

Answers (2)

Satpal
Satpal

Reputation: 133403

Use .prop() instead of .attr()

$('#message').prop('placeholder', response);

Upvotes: 4

Use .prop() instead of .attr()

$('#message').prop('placeholder', response);

Read .prop() vs .attr()

Upvotes: 5

Related Questions