Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
hyperscript equvelant of jquery .on("click"

$( document ).ready(function() {
    console.log( "ready!" );
    var counter = 0;

    $("button").click(function() {
        e="<p class='test' _=\"on click append 'click me' to value of the #search\">click me</p>"
        $("h2").append(e)
    });

    // With on():

    $("h2").on("click", "p.test", function(){
        alert($(this).text());
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://unpkg.com/hyperscript.org@0.8.1"></script>

<input id="search" />
<button>generate new element</button>
<h2></h2>

The jquery works, but the hyperscript doesn't append text to the input box.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Well, your hyperscript code appears to work like you intended. The jQuery seems to be the broken one. If you mean to append to the value that the user is typing. Ditch the jQuery appending and just use _hyperscript.

<script src="https://unpkg.com/hyperscript.org@0.8.1"></script>
<input id="search" />
<button _="on click append 'click me' to value of the #search">generate new element</button>
<h2></h2>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda