|
|
|
| Sunday, December 18, 2011 |
jQuery-Default-Button 1.2
Posted: 1:29:00 AM
|
I have committed version 1.2 of my jQuery Default Button plugin to Github just now. This update addresses two issues.
First, I wasn't returning the object, meaning you couldn't do jQuery style chaining with it. Now you can.
The second issue was more obscure, and I probably spent about 2 hours trying to figure this out on a project I've been working on. I am also using the jQuery Tiny Watermark plugin which displays a watermark in an input field when it doesn't have focus. The problem I was running into was that fields that used this watermark would stop responding to the enter key after a while.
It took me a while to figure out the problem. The watermark works by replacing the input boxes every time focus is gained or lost, and every time you replace the input box, it loses its events.
The solution was to let the event bubble up to the containing DIV, check to see if the element causing the event was an INPUT element, and then firing the click event on the target element. Not only does this resolve my problem, but it has the added benefit of using less memory because there's one event handler per form, not one event handler per INPUT on the form.Labels: Coding, jQuery Default Button
|
| Tuesday, December 06, 2011 |
An experiment in GitHub
Posted: 5:08:00 PM
|
Just a small note that I'm beginning porting some of my projects over to GitHub, starting with the smallest ones first. Such as my jQuery Default Button plugin, now on version 1.1.
The goal is to get my open source stuff out in the open, hopefully getting it some more visibility. I know that default button functionality is one that many try to conquer, and having it sit doing nothing on my web server isn't exactly a great way to get my code out there in the open.Labels: Coding, GitHub, jQuery Default Button
|
| Sunday, October 03, 2010 |
jQuery Default Button 1.0
Posted: 5:28:00 PM
|
I was searching the Internet today for something that would replace asp:Panel's DefaultButton property. I found a lot of solutions, but the fact that you had to add several lines of code to every page didn't appeal to me.
What I wanted to do was something like this:
$("#LoginForm").DefaultButton("#LoginButton");
This jQuery snippet would simply take the login form with an id of "#LoginForm" and make it so that any time you pressed the enter button within that form, it would click the "#LoginButton".
Well, now I can. I created a jQuery plugin that does exactly this. Download jQuery Default Button 1.0.Labels: Coding, JavaScript, jQuery Default Button
|
|