I spent at least four hours trying to debug a strange and passive bug in a Google Gears app I am working on. After picking apart a couple hundred lines of code and reducing the script to the absolute basic functionality of just a few lines, I was completely stupefied that I still had not found the source of the problem.
I know the title of this post is a little complicated but I feel it best describes the problem at hand. In Javascript, objects, arrays and variables are all technically the same thing which allows you to do some interesting stuff - such as nesting functions inside arrays inside variables inside objects inside variables. There are of course issues of scope when doing this sort of thing, though. One problem I recently came across was that I needed to reference the parent object's self from within an anonymous function that is nested within an array.
This javascript function will allow you to easily inject text into a textarea wherever the caret/cursor is currently at. In addition, it also makes sure that the cursor and textarea scroll amount are in the correct place after the insertion. I have tested and verified this works in Firefox, IE7, Opera, Flock, Safari, and Maxthon.
As one of the commenter's reply states, "And again, another 37 reasons I only use jQuery for all UI development." That prett much sums it up!
37 Amazing jQuery Plugins
Everybody loves shortcuts, so why should you deny your users of this guilty pleasure when it comes to your javascript-driven web application? Giving your users the ability to execute commands with simple shortcuts can make all the difference in the usability of your application.
No matter what languages you program in, chances are you have uses for regular expressions. Even though they comprise of only simple operators and switches, it can can be very tough to memorize how to properly harness the power of regular expressions. This is where these cheat sheets come in handy!
A binary clock uses LEDs or other on/off displays to represent the time.
jQuery is a lightweight but VERY powerful Javascript Library that makes coding robust javascript and ajax applications a breeze! At only 14kb gzipped, or 24kb packed, it leaves a rather nominal footprint especially when you consider the features it provides.
JSON stands for Javascript Object Notation which is a data structuring format that is extremely clean and lightweight. Even though JSON is native to javascript (as in, it can be turned into an object directly by javascript), it is quite easy to handle with other languages, making it an ideal replacement of XML when javascript is involved with the exchange of data (i.e. ajax).