JQuery is easy to use (medium) and jquery is used

Source: Internet
Author: User

JQuery is easy to use (medium) and jquery is used
1. What is the difference between jQuyery and native JavaScript loading?

$ (Function () {}); $ (document ). ready (function () {}); window. onload = function () {}/* the above two writing methods are the same, but the above one is short for the first two jQuery writing methods and native JavaScript writing methods and window. what is the difference between onload? The two methods in jQuery are to wait until the DOM tree is loaded and then execute the window. onload is executed only after the entire HTML page is fully loaded. After understanding this, You can grasp the page loading time and perform some operations. */
2. Entry to jQuery and JavaScript mixed programming?
<Style type = "text/css"> div {height: 100px; width: 100px;} li {list-style: none; display: block; width: 200px; height: 100px; margin-bottom: 20px ;}</style> <script type = "text/javascript" >$ (function () {// document. getElementById ('box') method for retrieving elements in native JavaScript $ ('# box '). get (0 ). style. background = 'blue'; // The method for getting elements in jQuery and the entry for JavaScript mixed programming are operations using the JavaScript native method/* get () the method can be used to mix jQuery and native JavaScript. In the form of an array subscript. However, the $ ('lil'). length statement below is not a hybrid statement, because jQuery has the length attribute, so we need to differentiate it. */For (var I = 0; I <$ ('lil '). length; I ++) {// $ ('lil '). get (I ). style. background = 'green'; $ ('lil') [I]. style. background = 'pink ';}}); </script> <div id = "box"> div one </div> <ul> <li> HTML5 </li> <li> jQuery </li> <li> bootstrap </li> </ul>
3. are two methods of jQuery data serialization?

Currently, XML and JSON are the two most popular data exchange formats in web development. They are actually two standards that define the formats for data exchange on the Internet. The following describes how jQuery serializes the data to obtain the desired data format.

<Script type = "text/javascript"> $ (function () {// username = JamesGosling & password = jQuery console. log ($ ('form '). serialize (); // You can also convert the values in form to the data console in JSON format. log ($ ('form '). serializeArray ();/* [[name: 'username', value = 'jamesgosling'], [name: 'Password', value = 'jquery ']; return the data in JSON format. After learning Ajax, you will find that the transmission format in this format is very convenient. */}); </Script> <form action = "#" method = "get"> User Name: <input type = "text" name = "username" value = "JamesGosling"> password: <input type = "password" name = "password" value = "jQuery"> </form>

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.