Comparison of javascript Library (1) with DOM Function

Source: Internet
Author: User

1. Prototype Library

This is the first library to simplify document. getElementById () to $.

For example, the original var myele = document. getElementById ('id') is equivalent to var myele = $ ('id ')

In addition, $ also extends some features

For example, var eleArray = $ ('id1', 'id2', 'id3 ', and 'id4') can return an array containing four objects.

In addition to $, this function library also provides getElementsByClassName, addClassName for adding class names, removeClassName for removing class names, and so on.

2, jQuery

It is more powerful than prototype.

For example:
Document. getElementById () ==>$ ('# money ')

Document. getElementsByTagName ==>$ ('P ')

Returns the element with the same class name: $ ('. money ')

And can be derived like css: $ ("# content table. dateTable ")

The css rule analysis function provided in the jQuery library is amazing. It supports css1, css2, css3, and most of the Selection Characters in XPath.

3. DoJo Library

Obtain the element object by id: var money = Dojo. byId ('money ')

Get the element by Class Name: Dojo.html. getElementByClass ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.