728x90
반응형
// Initialize Quill
var quill = new Quill('#quill-container', {
theme: 'snow' // or 'bubble'
});
// Function to set focus at the end of the document
function focusAtEnd() {
var length = quill.getLength();
quill.setSelection(length, length);
quill.focus();
}
// Example: Set focus to the end when a button is clicked
document.getElementById('your-button-id').addEventListener('click', function() {
focusAtEnd();
});
- 커서 활성화 : .focus()
- 맨뒤에 커서 활성화하기위해서 quill.getLength() 로 길이를 구해서 .setSelection()으로 원하는 위치에 커서를 이동시킬 수 있다.
728x90
반응형
'Front > JS & jQuery' 카테고리의 다른 글
[js] document.referrer (2) | 2024.02.14 |
---|---|
[js] 배열이 같은지 비교하기 (0) | 2024.02.13 |
[jQuery] comboTree.js plugin 으로 comboTree 만들기 (0) | 2024.02.06 |
[jQuery] flat Array to tree Array (0) | 2024.02.05 |
[jQuery] Set으로 배열 중복제거하기 (0) | 2024.02.04 |