我知道我的 jQuery,但遗憾的是对 Prototype 知之甚少。
$(function() {
$('#home-gallery-container').append('<a href="/images/cobra_sale.jpg" alt="" rel="lightbox-home" id="special-home" ><img src="/images/tag.png" alt="Special" /></a>');
});
如果添加任何额外内容,我将如何在 Prototype 或 Magento 的库中执行此操作。
请注意,在上面的示例中,我考虑到了 jQuery.noConflict()
等
最佳答案
这应该有效:
$('home-gallery-container').insert({
bottom:'<a href="/images/cobra_sale.jpg" alt="" rel="lightbox-home" id="special-home" ><img src="/images/tag.png" alt="Special" /></a>'
});
关于javascript - 我需要使用 Prototype 来做一些我可以在 jQuery 中轻松完成的事情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2293346/