Reputation: 2305
Trying to add a link in a Bootstrap popover (to go to a "Help" page). Seen all sorts of complicated solutions of getting a link inside a popover but someone suggested a simple onclick window.open
. Seemed an interesting solution BUT I am in double/single quote hell.
I am using phpStorm which does a pretty good job highlighting errors. What I am trying is:
<i class="explain fa fa-question-circle text-primary"
data-toggle="popover" data-trigger="focus" tabindex="0" title="Popover title"
data-content="And here's some amazing content. It's very engaging.<a href='#'
onclick='window.open("http://www.google.com/");' title='test add link'>
link to content</a> Right?"></i>
Here is the original I copied:
<a href="#" onclick="window.open('http://www.google.com/');\"> link </a>
My problem is that when I switch single to double I get an error at the initial "
of ("http://www.google.com/");
and have an unclosed tag.
What am I not understanding re this call please.
Upvotes: 0
Views: 2029
Reputation: 82
You need to include data-html="true"
along with your other data-*
Here is the jsFiddle
Upvotes: 0
Reputation: 187
Try using " within the HTML attribute:
<i class="explain fa fa-question-circle text-primary"
data-toggle="popover" data-trigger="focus" tabindex="0" title="Popover title"
data-content="And here's some amazing content. It's very engaging.<a href='#'
onclick="window.open('http://www.google.com/');" title='test add link'>
link to content</a> Right?"></i>
Compare here: How to properly escape quotes inside html attributes?
Upvotes: 3