alex
alex

Reputation: 490323

I need to use Prototype to do something I can easily do in jQuery

I know my jQuery, but sadly don't know much about 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>');
});

How would I do this in Prototype, or Magento's library if that adds anything extra.

Note in the sample above, I have taken into account jQuery.noConflict() etc

Upvotes: 1

Views: 139

Answers (1)

Josh
Josh

Reputation: 11070

This should work:

$('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>'
});

See Element.Insert in Prototype's Docs.

Upvotes: 3

Related Questions