Lathif Nya Safa Lathif Nya Safa - 18 days ago 7
Javascript Question

event on click not working in echo php

how to echo in php



iam try write sintax :
echo ' < div class=" city " onclick=" openCity(event,'London') " > ';
but event onclick not working

Answer

You have an issue with your quotes. You must escape the ones that suround your "London" arguement. Try this instead:

echo ' < div class=" city " onclick=" openCity(event,\'London\') " > ';