Skip to content

Instantly share code, notes, and snippets.

@bearr
bearr / quote-wrap.js
Created November 15, 2021 14:35
wrap selected text with quotes - IDE style
const search = document.querySelector([
'input[name="q"]', // google, github, ...
'input[name="query"]:not([type="hidden"])' // craigslist
].join(','))
if (search instanceof HTMLInputElement) {
search.addEventListener('keydown', function (event) {
let {
selectionStart: start,
selectionEnd: end