const element = document.querySelector(".class__name");
element.addEventListener("click", () => {
console.log("clicked element");
});
document.addEventListener('click', () => {
});
document.querySelector('div').addEventListener('click', () => {
console.log('div clicked');
});
element.addEventListener("click", function(){
element.innerText = "something";
});
document.querySelector("button").addEventListener("click", handle);
function handle() {
alert("I got clicked")
}
function first(){
alert( " hi it's Toofi");
}
task3Element.addEventListener('click', first);
addEventListener('click', (event) => {});
onclick = (event) => { };
document.addEventlistener("click", shootBullet)
function eventHandler(event) {
if (event.type == 'fullscreenchange') {
/* gestire un interruttore a schermo intero */
} else /* fullscreenerror */ {
/* gestire un errore di commutazione a schermo intero */
}
}
// src/EventListener/ExceptionListener.php
namespace AppEventListener;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentHttpKernelEventExceptionEvent;
use SymfonyComponentHttpKernelExceptionHttpExceptionInterface;
class ExceptionListener
{
public function onKernelException(ExceptionEvent $event)
{
// You get the exception object from the received event
$exception = $event->getThrowable();
$message = sprintf(
'My Error says: %s with code: %s',
$exception->getMessage(),
$exception->getCode()
);
// Customize your response object to display the exception details
$response = new Response();
$response->setContent($message);
// HttpExceptionInterface is a special type of exception that
// holds status code and header details
if ($exception instanceof HttpExceptionInterface) {
$response->setStatusCode($exception->getStatusCode());
$response->headers->replace($exception->getHeaders());
} else {
$response->setStatusCode(Response::HTTP_INTERNAL_SERVER_ERROR);
}
// sends the modified response object to the event
$event->setResponse($response);
}
}
element .addEventListener( event, function, useCapture );
eventListener()