TAILIEUCHUNG - ASP.NET 4 Unleased - p 181

Bằng cách đó, bạn đang đảm bảo rằng trang của bạn đã sẵn sàng trước khi nó chạy mã của bạn. Nếu không, logic của bạn có thể bắt đầu thực hiện trước khi trang đã hoàn tất tải, và mã của bạn không thể làm việc như mong đợi. Trong Ví dụ 40,2, kịch bản của chúng tôi nói với các trình duyệt để thực hiện các sayMessage () phương pháp khi tài liệu đã sẵn sàng. Khi bạn thực thi các trang, bạn có thể xem hộp cảnh báo bật lên ngay khi bạn mở trang. | 1774 CHAPTER 40 Client-Side AJAX with jQuery points during an application s execution. The document .ready event fires when the Domain Object Model DOM is loaded. Generally you can put most of your jQuery code in this event document .ready function your jQuery code goes here By doing so you re ensuring that your page is ready before it runs your code. Otherwise your logic might start executing before the page has completed loading and your code might not work as expected. In Listing our script tells the browser to execute the sayMessage method when the document is ready. When you execute the page you can see the alert box pop up as soon as you open the page. Although it appears to pop up right away the browser is actually waiting until any other page-preparing logic has completed and is ensuring that the DOM is fully loaded. When those conditions are met the code in document .ready fires and you see the alert box. jQuery Selectors Selectors are a core piece of the jQuery library. jQuery code follows this basic methodology Select an element. Do something with it. As we mentioned above the is the method that you use to select elements. For document .ready we re actually selecting the document and defining what to do when the ready event fires. You can select any element or multiple elements on your page. Following are three basic ways of selecting elements By ID Matches a single element with the element ID. The ID you provide should be prefaced by a character. For example myId would match div id myId . By CSS Class Matches all elements with the provides CSS class. The class you provide should be prefaced with a . character. For example .navigationListItem would match li class navigationListItem . By Element Matches all elements by tag name. For example div would match div id myId1 and div id myId2 . From the Library of Wow eBook What Is jQuery 1775 After selecting an element or elements you need to do something with it. For example you can define what should .

TÀI LIỆU MỚI ĐĂNG
1    3    0    10-08-2020
230    7    0    10-08-2020
54    5    0    10-08-2020
6    5    0    10-08-2020
20    3    0    10-08-2020