繁体   English   中英

jQuery:insertAfter()在Firefox上不起作用

[英]jQuery: insertAfter() doesn't work on Firefox

我使用此功能在输入框后创建一个提示按钮。

function hint_draw() {
    var inputs = document.querySelectorAll("#formIDHere input[name='name[]']");
    for(i=0; i < inputs.length; i++) {
        var button = document.createElement("a");
        button.innerHTML = "<img src='image/hint.jpg' width='32' height='32'></img>";
        button.href = "javascript:hint("+ i +")";
        $(button).insertAfter(inputs[i]);
    }
}

这段代码在Chrome中可以正常运行,但在Firefox中则无法运行。 为什么?

编辑:真的,此脚本工作正常。 也许我在其他方面有问题。 最好的答案是jQuery:insertAfter()在Firefox上不起作用,但这是一个注释,所以我不能接受。 再见!

http://jsfiddle.net/hfj3cs08/6/这种提琴效果很好。

可能是您的Firefox版本不支持该标记。

像下面一样更改button.innerHTML

button.innerHTML = "<img src='image/hint.jpg' width='32' height='32'/>";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM