如何更改文本区域的占位符?

qad*_*nza 2 forms jquery textarea placeholder attr

此代码提交了一个表单,并且可以正常工作,但更改textarea的占位符除外 id=message

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

Firebug中没有错误。

Tus*_*har 5

使用.prop()而不是.attr()

$('#message').prop('placeholder', response);
Run Code Online (Sandbox Code Playgroud)

阅读.prop()与.attr()