因此,我正在研究点击图片时弹出的幻想扩展器的事情 - 想想点击谷歌图片搜索结果时弹出的东西(我没有写出大量的代码),它是设立这样的每个元素:jQuery,如何在创建元素时嵌套HTML标签?
<a href="http://i.local.dev:5000/EW3GugE.jpg"
data-largesrc="http://i.local.dev:5000/EW3GugE.jpg"
data-title="http://i.local.dev:5000/EW3GugE.jpg"/>
<div class = "thumbcontainer">
<img src="http://local.dev:5000/thumbs/EW3GugE.jpg" />
</div>
“数据标题”属性被由JavaScript评价,jQuery的代码创建这样的元件,同时,这是在标题属性中的文本,并把它的内部一个textarea,然后将其附加到弹出框中:
this.$title = $('<textarea></textarea>');
this.$details = $('<div class="og-details"></div>').append(this.$title,
this.$description, this.$href);
this.$details = $('<div class="og-details"></div>').append(this.$title,
this.$description, this.$href);
这工作正常,它将文本放入文本框中。但我需要做的是进行一些设置高亮/各种其他的标记链接,类似于:
[IMG] http://i.imgur.com/5VbkHIP.jpg [/ IMG]
没有认为这会工作,但我试过:
this.$title = $('<textarea>[IMG][IMG]</textarea>');
它没有工作。有没有一种方法可以指定这些图片标签之间的文字?我应该将它们评估为字符串并将它们结合起来,还是这是一种不好的方法?谢谢
不工作 - 现在所有这些都是在文本框中是[IMG] [/ IMG],链接不它们之间。 – jack