php outputs an html, after the html is send to the browser you see a "web page". After that the backend(php) cant control what your browser already have.
you can try using php sockets if you like https://socketo.me/docs/ but there is still some js ...