S
S
Stanislav Nekrasov2018-09-24 16:15:33
HTML
Stanislav Nekrasov, 2018-09-24 16:15:33

How to make sure that the cursor does not go to the very beginning?

There is this block:

<div contenteditable class="text code-text" oninput="syntax();">print("Hello, world!")</div>

Syntax function:
function syntax () {
    // .....
    // codeText - Элемент с классом code-text
    // _code - Изменённый код
    codeText.innerHTML = _code;
}

After the function has worked, the cursor goes to the beginning, and since this happens with every oninput, it is impossible to write code.
How to make sure that the cursor does not go to the beginning?
UPD1:

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2018-09-24
@Metalofon

https://stackoverflow.com/questions/8236427/save-r...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question