A selection of questions on jquery classic face

Source: Internet
Author: User
Tags dashed line jquery cdn

jquery is a very popular JavaScript framework, and if you want to engage in web front-end development, jquery is a technology that you have to master and be proficient with.

This article has compiled some of the classic questions and answers about jquery and shared it with the students who are interviewing for web development posts. Of course you can learn more about front end Tutorials (div+css+jquery) Tutorials.

Question: What does jquery's dollar sign $ do?

Answer: Actually the dollar sign $ is just the "jquery" Alias, it is the jquery selector, the following code:
$ (document). Ready (function () {
Of course you can also use jquery instead of $, the following code:
jQuery (document). Ready (function () {

});
jquery is the use of this dollar symbol to achieve a variety of flexible DOM element selection, such as $ ("#main") is the ID of the element is selected.

question: What is the difference between the onload () function in the body and Document.ready () in jquery?
Answer: The difference between onload () and Document.ready () has the following two points:
1. We can use multiple document.ready () in the page, but only one time, onload ().
2. The Document.ready () function is called after the page DOM element has been loaded, and the onload () function is called after all associated resources (including images, audio) have been loaded.

question: What kinds of selectors are there in jquery?

Answer: From my own point of view, there can be 3 types of selectors, as follows:
1. Basic selector: Returns the matching DOM element directly from the ID, CSS class name, and element name.
2, hierarchical selector: Also known as the path selector, you can select the corresponding DOM element according to the path hierarchy.
3. Filter selector: Filter the relevant conditions on the previous basis to get the matching DOM elements.

question: Use jquery to set all the element borders on the page to a 2px wide dashed line?

Answer: This is the time for the jquery selector to play, the code is as follows:

Question: What should I do when the jquery file on the CDN is not available?

Answer: To conserve bandwidth and the stability of script references, we use jquery files on the CDN, such as Google's jquery CDN service. However, if the jquery service on these cdns is not available, we can also switch to the jquery version of the local server by using the following code:



Question: How do I use jquery to implement a click button to pop up a dialog box?
Answer: The code is as follows:
Html:

Jquery:


Question: What is the function of the delegate () function in jquery?
Answer: Delegate () will be used in the following two cases:
1. If you have a parent element that needs to add an event to the child element under it, then you can use Delegate () and the code is as follows:

$ ("ul"). Delegate ("Li", "click", Function () {

$ (this). Hide ();

});
2, when the element is not available in the current page, you can use Delegate ()
question: How do I encode and decode URLs in jquery?
answer: In jquery, we can encode and decode URLs using the following methods.
encodeuricomponent (URL) and decodeuricomponent (URL)

question: How do I disable the browser's forward back button with jquery?

> answer: the implementation code is as follows:
view plaincopy on code to see a snippet derived from my Code slice

More front-end design HTML Tutorials can be found in e-mentor Web learning.

A selection of questions on jquery classic face

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.