estaba configurando un script de Tampermonkey y lo estaba probando, también estaba tratando de usar el botón de tabulación (->) pero si lo presiono, no salta al siguiente hipervínculo, sino que pone algunos espacios en mi texto. ¿Alguien me puede ayudar? Estaría muy agradecido.
// ==UserScript== // @name Edit any Website // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match *://*/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // ==/UserScript== (function () { 'use strict'; // javascript:document.body.contentEditable = 'true' ; document.designMode = 'on'; document.querySelectorAll('a').forEach((a) => { a.addEventListener('click', (e) => { location = e.currentTarget.href; }) }) })(); var inputs = $(':input').keypress(function(e){ if (e.which == 9) { e.preventDefault(); var nextInput = inputs.get(inputs.index(this) + 1); if (nextInput) { nextInput.focus(); } } }); $(function () { $('textarea').keydown(function(e) { var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); var start = $(this).get(0).selectionStart; var end = $(this).get(0).selectionEnd; // set textarea value to: text before caret + tab + text after caret spaces = "\t" $(this).val($(this).val().substring(0, start) + spaces + $(this).val().substring(end)); // put caret at right position again $(this).get(0).selectionStart = $(this).get(0).selectionEnd = start + 1; } }); });