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 section near the end of the document. In this case, the jQuery plugin is stateless.
In the next post, Building Stateful jQuery UI Plugin Using Widget Factory, you will see how to create a stateful jQuery plugin using jQuery Widget. And you will see how the widget is a better solution for plugins that require user interaction, because the Widget factory helps you maintain state.
Web sites reflect the company’s professional image. If your site renders improperly or not at all, your company’s reputation can be tarnished. If your site has browser display problems, visitors and potential customers will leave your site and not look back.
In the post Using Modernizr, Polyfills, YepNope, you learned how you can support browsers that might not have the capabilities that you need. But at some point you may not be able to support really old browsers. At that point, you may just want to recommend the user update. Even for enterprise apps, you will want to remind users to use a current browser rather than have your app fail because your app is expecting something that does not exist.>p>You can use the following code to help your users get up to date browsers. Continue reading “Snippet – What to Do About Old Browsers”
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 RequireJS, AppCache, you learned that your Web app did not have to be online to be run. In fact, when building HTML apps for mobile devices, you are running without a connection.
So how do you check? How do you know when you can upload and download new information from the Web?
Many of the comments on StackOverflow have to do with the connection hanging. The following snippets help you work around the issue.
Continue reading “Snippet – Checking Internet Connection, No More Hanging App”
So what is wrong with the simple getJSON call? Why doesn’t it work?
It works fine in Firefox 11 but not in IE and Chrome. By default, IIS6 does not serve .json (no wildcard
MIME type). So you will see a 404 not found thrown.
By default, IIS in Windows Server 2003 and beyond does not serve files that aren’t of a MIME type that it knows about (instead returning 404 errors).
So, to serve up JSON files you need to add a MIME type to IIS to allow it to serve that type of file. You can set it at the site level or at the server level.
Continue reading “Tip – Serving .json File on Windows (IIS, IIS Express)”
So how can you use the check-boxes from Font Awesome, and get the box to check/uncheck. When a user clicks, how do I show the right icon?
When checked: icon-check ; unchecked: icon-check-empty.
The basic idea is to select spans:before that is next to input you want..
If you are using less/sass, you could just include the .icon-glass:before declarations, to make it all easier to maintain & modify. Continue reading “Snippet – Using FontAwesome, Bootstrap, MVC for Checkbox, Radio Controls”