创建超链接

时间:2015-05-04 07:31:04

标签: jquery hyperlink

我不知道如何将此链接转换为Jquery中的超链接。我是语言新手,无法弄清楚。我做了很多研究,但仍然没有运气。这就是我所拥有的:

content:" <div class='map_dir'><span class='dir'>Get Directions: </span>https://goo.gl/maps/N7fmt</div></div>"

我如何才能将谷歌地图链接变成可点击的超链接?

非常感谢, 迈克尔

2 个答案:

答案 0 :(得分:1)

只需将https://goo.gl/maps/N7fmt
替换为<a href='https://goo.gl/maps/N7fmt'>https://goo.gl/maps/N7fmt</a>

即可

答案 1 :(得分:0)

您只需使用anchor element ("")即可。我创建了一个例子:

$("div").html(
  "<div class='map_dir'>GetDirections: <a href='https://goo.gl/maps/N7fmt' class='dir'>https://goo.gl/maps/N7fmt</a></div>");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div></div>

我们将一个包装的锚放入DIV元素中。 http://api.jquery.com/html/