jQuery Common Coding tips:
1, less code by chain coding
2, Use data method instead of storing data inside the DOM.
$('selector').data('meaningfullname', 'this is the data I am storing');
// then later getting the data with
$('selector').data('meaningfullname');
3, If you are Manipulating the DOM a lot, use livequery.(1.3)
$('div.edit').livequery('click', function(){
//go into edit mode
});
4, Use classes as flags:With jQuery you can add a class with the addClass method and then check later if an element has the class with the hasClass method.
5, use same function name to handle different arguments
6, pass options for configuration data
7, test your code by screw.unit
8, make most jQuery code into resuable plugins
jQuery plugin pattern tips:
(from: http://www.learningjquery.com/2007/10/a-plugin-development-pattern)
1. Claim only a single name in the jQuery namespace
2. Accept an options argument to control plugin behavior
3. Provide public access to default plugin settings
4. Provide public access to secondary functions (as applicable)
5. Keep private functions private
6. Support the Metadata Plugin
分享到:
相关推荐
C++ Gotchas Avoiding Common Problems in Coding and Design 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Verilog and system verilog学习的好资料, Verilog and SystemVerilog Gotchas_101 Common Coding Errors and How to Avoid Them
processing-creative coding and computational art 的英文网页版,可以通过谷歌浏览器自动翻译来变成中文看
eclipse colortheme plug and zencoding plugineclipse colortheme plug and zencoding plugin
Introduction To Digital Audio Coding And Standards
The goal in this book is to give you a complete education on web coding and development. You learn how to set up the tools you need, how to use HTML and CSS to design and build your site, how to use ...
Coding best practices 15 Basic organization 15 Isolate tasks into functions 16 Use classes 16 Use descriptive variable names 16 Use descriptive function names 17 Separate logic and display ...
In addition to evaluating the impact of different types of video content and powerful feature sets on HEVC coding efficiency, the text provides an in-depth study on the practical performance of ...
Network Coding and Subspace Designs 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
and more than 200 illustrations of code structures, encoding and decoding circuits and error performance of many important codes and error control coding systems. Appropriate for those with minimum ...
BS ISO_IEC 23008-2-2015Information technology. High efficiency coding and media HEVC H.265
in the general area of network coding and its applications in various areas of communication networks. We assume that the readers of this book have only a general background in networking, with no ...
and more than 200 illustrations of code structures, encoding and decoding circuits and error performance of many important codes and error control coding systems. Appropriate for those with minimum ...
The Coding Group consists of enthusiastic research students, research and teaching staff members providing a very stimulating environment to work. Also being driven by academic research, a ...
The first deals mainly with VHDL coding. Chapters 1-6 are included in the first part. In these chapters, the reader will see how simple and complex designs can be coded into synthesizable VHDL. ...
Software Development, Design and Coding With Patterns, Debugging, Unit Testing, and Refactoring 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索...
Coding and Information Theory,信息论与编码入门的一本书
Next-Generation Video Coding and Streaming 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权...
iterarive coding and modulation library
With Software Development, Design and Coding, author and professor John Dooley distills his years of teaching and development experience to demonstrate practical techniques for great coding. ...