Todavía soy muy nuevo en jQuery y no estoy seguro de por qué esto no funciona. Quiero desvanecer cualquier elemento en el que se haga clic usando jQuery.
html:
<head> <script src="https://code.jquery.com/jquery-3.6.0.js"></script> <script src="basicFile.js" defer></script> <title>fade Out any clicked on element</title> </head> <body> <p> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sed magnam nisi animi itaque labore tempore porro iure amet accusamus? Eos, similique! Maxime maiores totam rem! </p> <div>enter code here this is another paragraph </div> </body>Guion:
$(document).ready( $('*').on('click', () => $(this).fadeOut(2500) ) )También he probado:
$(document).ready( $('*').click( () => $(this).fadeOut(2500) ) )