Dynamically update post title in admin page

by FosAvance   Last Updated June 12, 2019 07:08 AM - source

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?

Related Questions

Call current post URL in ajax

Updated October 25, 2017 17:08 PM

Open page in popup by hashtag in url

Updated November 21, 2017 10:08 AM

Ajax post doesnt call succes after got the response

Updated March 27, 2018 14:08 PM

Expand/collapse excerpt and content

Updated December 08, 2016 08:03 AM

Add confirmation popup on “Move to Trash”

Updated June 29, 2017 01:08 AM