联系表单7自定义占位符文本

I have a contact form on every post. I am trying to display a different placeholder text on subject field on every post, where subject field placeholder text should be equal to the post title.

So this is current contact form tag:

[text text-900 placeholder "Subject"]

I tried replacing Subject with

<script>
 $("input").val("<?php echo $post; ?>");
</script>

but it hasn't worked.

Please help me solve this problem :)

Try this

jQuery('.wpcf7-form input[type=text]').attr("placeholder", "Your Post Title")

Complete PHP Code is below. Tested.

<script type="text/javascript">
    jQuery('.wpcf7-form input[type=text]').attr("placeholder", "<?php the_title(); ?>");
</script>

First add the class like this as per the docs of contact-form 7

 [text class:subject_form text-900 placeholder "Subject"]

then on somewhere at top of your .php file initilalize the global variable of title

<script>
   page_title = "<?php echo the_title()?>";
</script>

then

in jQuery

<script>
   jQuery('.wpcf7-form input.subject_form').attr("placeholder", page_title);
</script>