Reputation: 49384
I am trying to get an onclick to fire but it just won't, been trying for hours now.
Can anyone see any issues with the following code?
output += '<li><a href="#" onclick="window.plugins.childBrowser.showWebPage('http://www.google.com',{ showLocationBar: true });">link</a></li>';
I have the feeling it's something to do with the syntax somewhere.
Upvotes: 0
Views: 71
Reputation: 2558
You have a '
-delimited string within a '
-delimited string. You need to escape the inner '
:
output += '<li><a href="#" onclick="window.plugins.childBrowser.showWebPage(\'http://www.google.com\',{ showLocationBar: true });">link</a></li>';
Upvotes: 2
Reputation: 324620
Look at the colour coding of your own post. Clearly you need to escape the single quotes inside the string.
output += '<li><a href="#" onclick="window.plugins.childBrowser.showWebPage(\'http://www.google.com\',{ showLocationBar: true });">link</a></li>';
Upvotes: 3
Reputation: 207501
You have a problem with quotes. Look at the error console I am sure it is yelling at you.
You need to escape the with a \
output += '<li><a href="#" onclick="window.plugins.childBrowser.showWebPage(\'http://www.google.com\',{ showLocationBar: true });">link</a></li>';
Upvotes: 3