jQuery in Action phần 6

Tham khảo tài liệu 'jquery in action phần 6', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 102 CHAPTER 4 Events are where it happens In addition to the bind command jQuery provides a handful of shortcut commands to establish specific event handlers. Because the syntax of each of these commands is identical except for the method name of the command we ll save some space and present them all in the following single syntax descriptor Command syntax specific event binding eventTypeName listener Establishes the specified function as the event handler for the event type named by the method s name. The supported commands are as follows blur focus mousedown resize change keydown mousemove scroll click keypress mouseout select dblclick keyup mouseover submit error load mouseup unload Note that when using these shortcut methods we cannot specify a data value to be placed in the property. Parameters listener Function The function that s to be established as the event handler. Returns The wrapped set. jQuery also provides a specialized version of the bind command named one that establishes an event handler as a one-shot deal. Once the event handler executes the first time it s automatically removed as an event handler. Its syntax is similar to the bind command and is as follows Command syntax one one eventType data listener Establishes a function as the event handler for the specified event type on all elements in the matched set. Once executed the handler is automatically removed. Parameters eventType String Specifies the name of the event type for which the handler is to be established. data Object Caller-supplied data that s attached to the Event instance for availability to the handler functions. If omitted the handler function can be specified as the second parameter. listener Function The function that s to be established as the event handler. Returns The wrapped set. The jQuery Event Model 103 These commands give us many choices to bind an event handler to matched elements. And once a handler is bound we may eventually need to remove it. .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.