Focusing and Blurring Elements with the jQuery JavaScript Library
(Page 1 of 4 )
If you’re a web designer who’s looking for a JavaScript library that lets you develop powerful client-side applications by using a friendly programming interface, then I have great news for you. This series of articles gets you started using the most relevant features that comes packaged with the jQuery JavaScript framework. You'll be able to get the most out of this useful piece of software in a very short time. This is the fifth article in an eight-part series.
Introduction
Having already introduced you to the primary subject of this article series, it’s time to quickly review the topics covered in the preceding tutorial. This way, you’ll be able to link them more easily with the ones that I plan to discuss in this part.
Well, as you’ll possibly recall, in that particular article I developed a couple of rudimentary JavaScript applications, which were aimed at demonstrating how to handle “keydown” and “keyup” events by means of the jQuery API. I showed you that it was a straightforward process that only required attaching the appropriate library’s methods to the web page elements that originated these common keyboard actions.
Indeed, the native capabilities of jQuery for handling different mouse and keyboard events are quite impressive, but they're only a small part of what can be done with it. The library comes with a robust set of additional methods that can be used to handle both “focus” and “blur” events with ease. In fact, with this library, it’s pretty simple to build JavaScript applications that respond to these particular events in a truly cross-browser fashion.
Therefore, if you're interested in learning how to handle these specific events with jQuery, in the next few lines I’m going to develop some illustrative examples that will show you how to fire up a JavaScript function each time a web page element gets focus; I'll also show you how to handle it when such elements get blurred. In addition, I’ll be teaching you how to use the library to detect when a web form has been submitted by a user, so there’s a lot of material ahead of us that needs to be examined in depth.
Let’s explore a few more useful features that come with the jQuery framework. Let’s jump in!
Next: Introducing the focus() method >>
More JavaScript Articles
More By Alejandro Gervasio