I just wonder how people work with double and single quotes. I have a code where i got a little problem.
If i for example got this code:
<img src="img_fjords.jpg" onclick="document.getElementById('someID').style.display='block'" class="w3-hover-opacity">
Now i got no problem, but if im going to put this inside a echo ""
then i start getting problems, so i changed all the double quotes to single quotes and used double quotes for the echo, but still it will not accept it, i think i got to many single quotes now. and i think i need to do something different with "someID"?
echo code:
echo "<img src='img_fjords.jpg' onclick='document.getElementById('someID').style.display='block'' class='w3-hover-opacity'";
You have to escape double quotes if your string is put in double quotes by using backslash
\
character. Here is an example:So in your case it will be:
Ref: Double quotes within php script echo
You can escape the quotes where needed (using backslashes before the quote signs):