// The anwer of Innocent Ibis is wrong!!// It should not have a # for the ID seens we are using getElementByIdvar element =document.getElementById("id");
element.addEventListener('click',function(){console.log("click");});
// Using javascriptvar element =document.getElementById("#id");
element.addEventListener('click',function(){console.log("click");});// Using JQuery$("#id").click(function(){console.log("click");});
functioneventHandler(event){if(event.type=='fullscreenchange'){/* gestire un interruttore a schermo intero */}else/* fullscreenerror */{/* gestire un errore di commutazione a schermo intero */}}
<body style="height: 5000px"><style>
body,/* blink currently has bug that requires declaration on `body` */
html {
scroll-snap-type: y proximity;}.snaptarget{
scroll-snap-align: start;position: relative;top: 200px;height: 200px;
background-color: green;}</style><div class="snaptarget"></div></body>
// src/EventListener/ExceptionListener.php
namespace AppEventListener;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentHttpKernelEventExceptionEvent;
use SymfonyComponentHttpKernelExceptionHttpExceptionInterface;classExceptionListener{publicfunctiononKernelException(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 =newResponse();
$response->setContent($message);// HttpExceptionInterface is a special type of exception that// holds status code and header detailsif($exception instanceofHttpExceptionInterface){
$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);}}
classMyComponentextendsReact.Component{constructor(props){super(props);this.state={message:""};this.handleEnter=this.handleEnter.bind(this);this.handleKeyPress=this.handleKeyPress.bind(this);}// change code below this linecomponentDidMount(){document.addEventListener("keydown",this.handleKeyPress);}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyPress);}// change code above this linehandleEnter(){this.setState({message:this.state.message+"You pressed the enter key! "});}handleKeyPress(event){if(event.keyCode===13){this.handleEnter();}}render(){return(<div><h1>{this.state.message}</h1></div>);}}