Disable the browsers auto-complete mechanism

If your creating some kind off wizzy AJAX auto-complete function that populates an your input text box you will probably want to turn the browsers auto complete feature off.

You could do this in plain HTML

view plain print about
1<input name="searchTerm" type="text" autocomplete="off"/>

The problem is that this would not be in keeping with the principle of progressive enhancement. In other words you would be disabling the browers autocompletion function without offering a solution of your own. Also you HTML would be invalid.

Luckly, this can bee achived using the jQuery attr fucntion

view plain print about
1$('.searchTerm').attr('autocomplete','off');

JQuery Keyboard

For some reason I got it into my head that I would like to create an on screen keyboard that mimicked my actions. It was also a good chance to get stuck into some more JQuery. There were three main parts to this code.

[More]

Getting submitted form data with JQuery

Acquiring submitted form data with JQuery has always been a bit of a problem for me so I thought I would share how I (still a novice with JQuery) now handle this problem. My first method is to loop over all the input, select and textarea's within the form.

view plain print about
1$.each($("input, select, textarea"), function(i,v) { var theElement = $(this).attr('name'); var theValue = $(this).attr('value'); if (($(this).attr('type') == 'radio')){ if ($(this).is(':checked')){ alert(theElement + ' - ' + theValue); } } else { alert(theElement + ' - ' + theValue); } });

[More]

Clearing default input values

Here is a quick and easy snippet to remove default values from input fields on focus. For each result, it clears the default value onfocus and restores the default if the value is empty onblur.

view plain print about
1(function($){ $.fn.clearDefaultVal = function(){ return this.each(function(){ var default_value = $(this).val(); $(this).focus(function(){ if ($(this).val() == default_value) $(this).val(""); }); $(this).blur(function(){ if ($(this).val() == "") $(this).val(default_value); }); }); }; })(jQuery); $('input.cleardefault').clearDefaultVal();

Shopping cart form with JQuery validation

I thought this would be a good starting point for anyone who is creating a shopping cart and needs a form to process the details. Although the form comes with some JQuery validation I would recommend that you also add server side validation for those 5% of users that have javascript turned off.

[More]

Coldfusion and Jquery's auotcomplete plugin

Jquery has many excellent plugins. The latest one that I have been playing around with is the autocomplete plugin. This plugin enables the user to autocomplete an input field to help quickly find and select some value, leveraging searching and filtering. The following demo will show you how to implement this plugin with coldfusion.

[More]

Finding the index of a list element in jQuery

I have a typical HTML list of contacts. Inside each list element is a div containing the contacts details. I want the all the contacts details to be hidden when the page loads and allow the user to select which contacts details they want to view. But how do I find out which list element I have selected? Here is what I did

[More]

Jquery pause function

I have a form making an Ajax call to the server and I wanted to briefly display a message telling the user the results of the call. I start with an empty div to display the message.

view plain print about
1<div id="alertMessage"></div>
Now I want the message to fade onto the page, wait for a couple of seconds and then fade out so I tried

[More]

Animating links with JQuery

I wanted to add some links to the bottom of this blog and then jazz them up using a little JQuery. Here is the code I used

[More]

Using TinyMCE with JQuery's POST request function

I've been having issues with submitting forms that contain a tinyMCE WYSIWYG editor when using Jquery's POST request function. The content that was in the WYSIWYG editor was not being submitted with the rest of the form. Luckily, after a bit of hunting around I found the answer.

[More]

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.5.004. Contact Blog Owner