+ 2
Is there any difference in using single quotes or double quotes in HTML?
Following code works properly if single quotes are used in document.getElementById('demo') But does not work for double quotes document.getElementById("demo") https://code.sololearn.com/W3AOPsfk4TH4/?ref=app
3 Réponses
+ 3
That bug happens because the statement in the onclick attribute is surrounded by double quotes so if you put another double quote inside it, it won't consider it as part of the string. Same with putting single quotes on both of them. Also, there isn't any difference in single quotes and double quotes in HTML.
+ 3
you can use both single and double quotes in javascript code. you can use use both quotes in html code, but it is recommended through convention to use double quotes for attribute values
+ 2
I have got my error thanks for the answer