用jQuery显示网址

用户名

我有一个脚本,完成某些操作后,将出现一个带有链接的按钮,该按钮不可单击。但我有一个问题。

这是代码:

FB.ui(e, function(t) {
        if (t["post_id"]) {
          //your download content goes here
          // Do something there
    var secret_data = "<a href=\"http://TEST.com\">";
          jQuery("#results").html(secret_data);
        } 
    })
<div id="results"><img src="img/button.png"></a>

我认为完成此操作后,代码将如下所示:

<a href="http://TEST.com"><img src="img/button.png"></a> 

但这不是..

那么有人有答案吗?

查理

如果您尝试将<a>现有图像包装起来,请使用wrap()

$('#results img').wrap('<a href="http://TEST.com"></a>'); 

使用html()将目标元素中的所有内容替换为新内容

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章