<script src="https://unpkg.com/jquery"></script>
$(document).ready(function() {
    if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
        $('#modo').html('logo dark');
    }else{
        $('#modo').html('logo light');    
    }
});
$.getJSON("arquivo.json",function(data){...});
Fonte: jQuery
function pegarFragmento(htmlStr,selStr){
    var $html = $('<div>'+htmlStr+'</div>');
    var conteudoDaDiv = $html.find(selStr).html();
    return conteudoDaDiv;   
}
(function($) {
    $.fn.mostrarAlerta = function(mensagem) {
        return this.each(function() {
            $(this).on('click', function() {
                alert(mensagem);
            });
        });
    };
})(jQuery);
$(document).ready(function() {
    $('#idDoBotao').mostrarAlerta('Esta é a mensagem de alerta.');
});
$.post("/user",{name:'Full Name'},function(data){
    alert( "resposta = " + data );
});
Fonte: jQuery
$(document).ready(function() {
  const textarea=$("textarea");
  textarea.on("keydown",function(event) {
    if(event.keyCode===13){
      if(!event.shiftKey){
        event.preventDefault();
        $(this).closest("form").submit();
      }
    }
  });
});
function executeAfterJQuery() {
    alert('jQuery está carregado. Execute seu código aqui.');
}
if(typeof jQuery=='undefined' && typeof Zepto=='undefined') {
    var script=document.createElement('script');
    script.src='https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js';
    script.onload=function() {
        executeAfterJQuery();
    };
    document.head.appendChild(script);
} else {
    executeAfterJQuery();
}