Mootools & jQuery : Inserting Elements

Mootools & jQuery : Inserting Elements

Well as you know I’ve been trying out MooTools recently, including starting a new series “Journey Into MooTools” at thewebsqueeze.com. And I have to say I really like it, especially creating elements. For example, I find:

var img = new Element(
"img", {src: 'myimage.jpg',
'class': 'galleryimg', 
alt: 'Check out this image'});


Nicer than:

var img = $(").attr("alt", "Check out this
image").attr("src", "myimage.jpg").addClass("galleryimg");

MooTools is the first one. I love it! If there is a nicer way to do it in jQuery (I can’t find one but I have a feeling there should be) then please let me know!

Newer Post

COMMENTS

Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On PinterestVisit Us On YoutubeVisit Us On Linkedin