javascript - 我需要使用 Prototype 来做一些我可以在 jQuery 中轻松完成的事情

标签 javascript jquery magento prototypejs

我知道我的 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>'
});

参见 Element.Insert in Prototype's Docs .

关于javascript - 我需要使用 Prototype 来做一些我可以在 jQuery 中轻松完成的事情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2293346/

相关文章:

javascript - 如何使用 javascript/jquery 克隆/复制 html 表

magento - 平面产品问题

magento - 如何在 Magento 中的 CSV 文件中写入一些数据?

javascript - 测试 RxJS observable 来跟踪最后发出的值(没有完整信号)?

javascript - 错误: [$controller:ctrlreg] The controller with the name 'CreatePortfolioController' is not registered

javascript - 如何获取日期对象

javascript - 使用 jquery 或 javascript 设置内联 block css

jQuery UI 选项卡最小样式

jquery - 检查元素样式并添加类

javascript - Google 条形图 - 如何使用 JSON 为每个条目获取 2 个不同的条形图