Set focus on div contenteditable element

后端 未结 9 2127
深忆病人
深忆病人 2020-11-29 01:51

I have a

where I define by a WYSIWYG some elements. For example

,

, etc. I would l

9条回答
  •  广开言路
    2020-11-29 02:19

    Old post but none of the solutions worked for me. I figured it out eventually though:

    var div = document.getElementById('contenteditablediv');
    setTimeout(function() {
        div.focus();
    }, 0);
    

提交回复
热议问题