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.
尝试在Bootstrap弹出窗口中添加链接(转到“帮助”页面)。看到各种复杂的解决方案,在弹出窗口中获取链接,但有人建议一个简单的onclick window.open。似乎是一个有趣的解决方案,但我在双/单引号地狱。
I am using phpStorm which does a pretty good job highlighting errors. What I am trying is:
我正在使用phpStorm,它可以很好地突出显示错误。我在想的是:
<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.
我的问题是,当我将单个切换为双倍时,我在初始“(”http://www.google.com/“)时收到错误;并且有一个未关闭的标签。
What am I not understanding re this call please.
请问,我不理解这个电话。
2 个解决方案
#1
2
Try using " within the HTML attribute:
尝试使用“在HTML属性中:
<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?
在这里比较:如何正确地转义html属性中的引号?
#2
0
You need to include data-html="true"
along with your other data-*
您需要包含data-html =“true”以及其他数据 - *
Here is the jsFiddle
这是jsFiddle
#1
2
Try using " within the HTML attribute:
尝试使用“在HTML属性中:
<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?
在这里比较:如何正确地转义html属性中的引号?
#2
0
You need to include data-html="true"
along with your other data-*
您需要包含data-html =“true”以及其他数据 - *
Here is the jsFiddle
这是jsFiddle