background preloader

Javascript

Facebook Twitter

Initiate drag after delay in jQuery UI Draggable without having to move mouse. Can jQuery .keypress() detect more than one key at the same time. JavaScript - Errors & Exceptions Handling. Advertisements There are three types of errors in programming: (a) Syntax Errors and (b) Runtime Errors (c) Logical Errors: Syntax errors, also called parsing errors, occur at compile time for traditional programming languages and at interpret time for JavaScript.

JavaScript - Errors & Exceptions Handling

For example, the following line causes a syntax error because it is missing a closing parenthesis: When a syntax error occurs in JavaScript, only the code contained within the same thread as the syntax error is affected and code in other threads gets executed assuming nothing in them depends on the code containing the error. Runtime errors, also called exceptions, occur during execution (after compilation/interpretation). For example, the following line causes a run time error because here syntax is correct but at run time it is trying to call a non existed method: Exceptions also affect the thread in which they occur, allowing other JavaScript threads to continue normal execution. Here is the try...catch...finally block syntax: What are the best practices for JavaScript error handling. Enterprise JavaScript Error Handling (Ajax Experience 2008) Brandonaaron/jquery-mousewheel. Backbone.CollectionView. Marionettejs/backbone.marionette. Developing Backbone.js Applications -

By Addy Osmani (@addyosmani) Available free for open-source reading below or for purchase via the O'Reilly store.

Developing Backbone.js Applications -

Pull requests and comments always welcome. Prelude Not so long ago, “data-rich web application” was an oxymoron. Today, these applications are everywhere and you need to know how to build them. Traditionally, web applications left the heavy-lifting of data to servers that pushed HTML to the browser in complete page loads. Think of the Ajax shopping cart which doesn’t require a refresh on the page when adding an item to your basket. The rise of arbitrary code on the client-side which can talk to the server however it sees fit has meant an increase in client-side complexity. Thankfully, there are a growing number of JavaScript libraries that can help improve the structure and maintainability of your code, making it easier to build ambitious interfaces without a great deal of effort. Target Audience Acknowledgements Credits Target Version Reading What Is MVC? What is Backbone.js? <! Views. Comment lire un PSD sans Photoshop « Korben Korben.

Mathiasbynens/jquery-placeholder. jQuery Validation Plugin. "But doesn't jQuery make it easy to write your own validation plugin?

jQuery Validation Plugin

" Sure, but there are still a lot of subtleties to take care of: You need a standard library of validation methods (such as emails, URLs, credit card numbers). You need to place error messages in the DOM and show and hide them when appropriate. You want to react to more than just a submit event, like keyup and blur. You may need different ways to specify validation rules according to the server-side enviroment you are using on different projects.

And after all, you don't want to reinvent the wheel, do you? "But aren't there already a ton of validation plugins out there? " Not convinced? A single line of jQuery to select the form and apply the validation plugin, plus a few annotations on each element to specify the validation rules. Of course that isn't the only way to specify rules. After trying to submit an invalid form, the first invalid element is focused, allowing the user to correct the field. If not, read on.