Changing the “placeholder” attribute of HTML5 input elements dynamically using Javascript

后端 未结 6 1133
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 16:03

I\'m trying to dynamically update the HTML5 placeholder attribute of a text field using jQuery.

$(\"textarea\").attr(\"placeholder\", \"New plac         


        
6条回答
  •  無奈伤痛
    2020-12-15 16:21

    I think you have to do that :

    $("textarea").val('');
    $("textarea").attr("placeholder", "New placeholder text");
    

提交回复
热议问题