Send keys using javascript on Overleaf

Viewed 150

I have been trying to send keys (just as if you are typing on the keyboard) on overleaf using javascript and jquery. I can see there is a .ace_cursor object but it does not seem to work when I try to do this:

$('.ace_cursor').html('test')

Am I using the wrong object to dispatch keys or the wrong approach to do so?

I have also attempted jquery's trigger for all elements in the page. E.g.,

$('.ace_content').click(() => {
var e = jQuery.Event( 'keypress', { which: 65} );
$('*').each(function(i, obj) {
    $(this).trigger(e);
    console.log($(this));
});
})
0 Answers
Related