在对象的Javascript数组中添加超链接 [英] Adding hyperlink in Javascript array of objects
本文介绍了在对象的Javascript数组中添加超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个对象数组,每个对象内都有一个答案"部分,但是我需要对某些特定的单词进行超链接,这些单词应将用户发送到网站.
I have an array of objects and within each object there is an answers section, but I need to hyperlink some certain words that should send the user to a website.
我在下面举了一个例子.
I have given an example below.
faq: [
{
answers: "The capital is London"
}
]
因此在上面的示例中,如果您可以向我展示如何在Javascript中超链接伦敦"一词,将非常有帮助.
So in the example above if you could show me how I can hyperlink the word London within Javascript it would be very helpful.
非常感谢!
推荐答案
只需在单词周围加上定位标记即可.像这样,并在//
Just surround the word with anchor tag . Like this and give url after //
<a href="//www.google.com">London</a>
这篇关于在对象的Javascript数组中添加超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文