我使用文本属性在我的网站上显示文本。我如何使文本重定向到一个网站时,点击?
这就是我现在的情况,
<div class="text abc" data-text="abc">
abc
</div>我试过以下几种方法
<div class="text abc" data-text="<b href='https://www.google.com'>abc</b>">
abc
</div>但这只会把"href“转换成文本,它实际上不会做它应该做的事情。(把我转到谷歌)
发布于 2019-06-06 10:07:10
尝试使用锚标记<a/>
<div class="text abc" data-text="abc">
<a href='https://www.google.com'>abs</a>
</div>卸锚的方法:
HTML:
<div class="text abc" data-text="abc">
<a class="no-underline" href='https://www.google.com'>abs</a>
</div>CSS:
.no-underline a {
color: #FFFFFF;
text-decoration: none;
}发布于 2019-06-06 10:05:44
你应该使用锚,这是建立链接的常用方法。
<a href='https://www.google.com'>Website</a>
如果您不想使用和没有蓝色链接,您将需要javascript,并将事件放在您的div上,如下
$('#myDivId').on('clik',function(){
//redirect with window location
}发布于 2019-06-06 10:06:19
https://stackoverflow.com/questions/56475234
复制相似问题