Skip to content

Instantly share code, notes, and snippets.

@kdankov
Created November 14, 2024 21:38
Show Gist options
  • Save kdankov/0af3dd6f8cfc80cab8f5e05a94378d79 to your computer and use it in GitHub Desktop.
Save kdankov/0af3dd6f8cfc80cab8f5e05a94378d79 to your computer and use it in GitHub Desktop.

Revisions

  1. kdankov created this gist Nov 14, 2024.
    10 changes: 10 additions & 0 deletions jquery-alias-selector.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    var $ = document.querySelector.bind(document);
    var $$ = document.querySelectorAll.bind(document);

    Element.prototype.$ = function() {
    return this.querySelector.apply(this, arguments);
    };

    Element.prototype.$$ = function() {
    return this.querySelectorAll.apply(this, arguments);
    };