// The anwer of Innocent Ibis is wrong!!
// It should not have a # for the ID seens we are using getElementById
var element = document.getElementById("id");
element.addEventListener('click', function(){
console.log("click");
});
// Using javascript
var element = document.getElementById("#id");
element.addEventListener('click', function(){
console.log("click");
});
// Using JQuery
$("#id").click(function(){
console.log("click");
});
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);
}
}