TAILIEUCHUNG - JQuery: Novice to Ninja- P18

JQuery: Novice to Ninja- P18:No matter what kind of ninja you are—a cooking ninja, a corporate lawyer ninja, or an actual ninja ninja—virtuosity lies in first mastering the basic tools of the trade. Once conquered, it’s then up to the full-fledged ninja to apply that knowledge in creative and inventive ways. | 232 jQuery Novice to Ninja be drag and droppable like it s a web site from the future Fortunately for us jQuery lets us build web sites from the future. Forms HTML forms are old. And a bit clunky. And browsers vary wildly in how they deal with them. Yet thanks to JavaScript these forms have become the basis for some amazingly cool web applications. As always if JavaScript can do it jQuery can make it fun We know the drill by now form elements are DOM elements so jQuery is great at manipulating them. But form elements aren t your typical DOM elements so there are a handful of special jQuery tricks for dealing with them more specifically. We ve seen quite a few of them throughout the book so far but now it s time to focus on them a little more closely. Simple Form Validation Form validation is essential even if it often seems boring. However proper well-designed and implemented forms can make or break how your users perceive your site. Who hasn t had the experience of giving up on a web site because of a particularly frustrating form Server-side Form Validation Client-side form validation with jQuery should only be used to assist your users in filling out a form and should never be relied upon to prevent certain types of data being sent to the server. Users with JavaScript disabled will be unhindered by your jQuery validation so they can submit any values they want. Because of this if there s any security risk from users submitting malicious data through your forms that data needs to be thoroughly validated on the server side. Although jQuery avoids dealing with the nitty-gritty of form validation it does provide some convenient methods for accessing and setting form values and that s half the battle You can select form fields like any other element but there are some extra filters to make your code more efficient and readable. Forms Controls and Dialogs 233 The input filter for example selects all elements that are inputs select boxes textareas or buttons. You d use

TÀI LIỆU MỚI ĐĂNG
15    5    0    14-08-2020
91    17    0    14-08-2020
1    7    0    14-08-2020
TÀI LIỆU XEM NHIỀU
TÀI LIỆU HOT
387    4    0
TÀI LIỆU LIÊN QUAN