How to click the button to bold the selected text?

I want to click a button after selecting the text of the contenteditable element on the page, and use the document.execCommand () method to bold the selected text, but when I click this button, the input box will blur and the corresponding text will not be obtained. how to solve the focus problem in this case?

Jun.21,2022

you can refer to this example

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ad50-2c227.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ad50-2c227.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?