2

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.

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
qadenza
  • 9,025
  • 18
  • 73
  • 126

2 Answers2

5

Use .prop() instead of .attr()

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

Read .prop() vs .attr()

Community
  • 1
  • 1
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
4

Use .prop() instead of .attr()

$('#message').prop('placeholder', response);
Satpal
  • 132,252
  • 13
  • 159
  • 168