In a blog post comment, I came across an interesting jQuery form alignment plugin:
jQuery.fn.autoWidth = function(options)
{
var settings = {
limitWidth : false
}
if(options) {
jQuery.extend(settings, options);
};
var maxWidth = 0;
this.each(function(){
if ($(this).width() > maxWidth){
if(settings.limitWidth && maxWidth >= settings.limitWidth) {
maxWidth = settings.limitWidth;
} else {
maxWidth = $(this).width();
}
}
});
this.width(maxWidth);
}
I integrated this as form_autoWidth.js
on my form page.
Additionally, I invoked this plugin from a separate file called form_align.js
:
$(document).ready(function() {
$('.cleartext').autoWidth();
});
Shouldn't this be aligning the input fields with the class .cleartext
?
Appreciate any help!