Dynamically update post title in admin page

I have a textarea in admin post page when creating new post, that’s title:

<textarea id=”post-title-0″ class=”editor-post-title__input” placeholder=”Add title” rows=”1″ style=”overflow: hidden; overflow-wrap: break-word; resize: none; height: 94px;”>vbhgfhfgh</textarea>

I want to update title on the fly using jQuery. I tried

$(‘#post-title-0’).val(‘some value’);
$(‘#post-title-0’).text(‘some value’);

I also tried using plain javascript.

val() updates title but when I click on title it is being erased. Is there anyway to update title via JS?

Read more here:: Dynamically update post title in admin page

Leave a Reply

Your email address will not be published. Required fields are marked *