javascript - why onclick not working as expected? -


i confused why onclick not wokring

code1:

onclick="return clicked('35','http://www.google.com');"  

code2:

onclick='return clicked('35','http://www.google.com');' 

if used code1 onclick works fine not code2

thnx

because you're breaking out of onclick soon, since use single quotes multiple things. first 1 doesn't break since can have single quotes in double quotes. if use second approach, escape single quotes in function call.


Comments

Popular posts from this blog

c++ - End of file on pipe magic during open -

basic authentication with http post params android -

data.table making a copy of table in R -