In the last post, Building Stateful jQuery UI Plugin Using Widget Factory, you were introduced to the working structure of jQuery UI Widgets. You learned that it uses the factory pattern is a way to generate different objects with a common interface. And that it Widget Factory adds features to jQuery plug-in. jQuery UI Widget... Continue Reading →
Object JavaScript – Building Stateful jQuery UI Plugin Using Widget Factory
In this post, you will learn step-by-step to build your own custom, reusable, testable jQuery UI widget. You will extend the jQuery library with custom UI code and then use it on a page. The initial plug-in will be trivial to demonstrate the jQuery Widget Factory pattern. You will provide properties that you can change... Continue Reading →
Object JavaScript – Building a Reusable Stateless jQuery Plugin
In this post, you will learn step-by-step to build your own custom, reusable, testable jQuery Plugin. There are times where you will want to reuse code that performs a series of operations on a selection. For example, you may want to embed information a span element and then have that information displayed in a references... Continue Reading →
Object JavaScript – ECMAScript 6 Code Preview
ECMAScript 6 specification and implementation is underway and promises to bring many of the features that you’ve learned about in the posts on Object JavaScript. This post gives you an idea of what the code looks like in ECMAScript 6. This post doesn’t cover ever feature. But you will learn about how ECMAScript 6 relates... Continue Reading →
Snippet – Checking Internet Connection, No More Hanging App
When you are writing your single page application (SPA) may find that you need to check your connection. The idea is that you might have one set of logic for your connected app and another for when you are disconnected. In previous posts, AppCache for Offline Apps and Loading, Caching LoDash or Underscore Templates Using... Continue Reading →
Object JavaScript – Code Walkthrough Initializing a Module That Needs RequireJS, jQuery, LoDash
RequireJS is a JavaScript file and module loader. In Getting Started with Modules Using RequireJS, you have learned a lot about how you can use it to load your dependencies using define() and require(). In this code snippet, you will learn how you can load the dependencies, initialize a module with values that you pass... Continue Reading →
Snippets – Filtering JSON Using jQuery Grep, Filter, Map
When you have a JSON array, you may want to get one or more items from the array and display. jQuery offers two functions that can help: grep and filter. $.grep(). Finds the elements of an array which satisfy a filter function. The original array is not affected. $filter(). Reduce the set of matched elements... Continue Reading →
Single Page App – isLoading jQuery Plugin to Indicate Content Loads
When you’re loading information using jQuery AJAX, you may want to provide visual feedback when loading data or for any action that would take time. In this Snippet, you will learn how to: Load JSON data from a getJSON call to our server. Show and hide a spinning indicator inside a div. Bind the incoming... Continue Reading →
Snippet – C#, JavaScript, jQuery, Underscore ForEach Loops
The foreach statement repeats a group of embedded statements for each element in an array or an object collection. The foreach statement is used to iterate through the collection to get the information that you want. It is not be used to add or remove items from the source collection to avoid unpredictable side effects.... Continue Reading →