I really like using jQuery – although I am a bit (only a tiny bit mind you) miffed about some of the functions which have been deprecated in version 1.2 – I used them! however there is an additional code bundle that will make them available… But in retrospect having to make your own is always good practice.
However, I’ve been playing around with writing some plugins for jQuery, they are by no means the most awe-inspiring things but they are solutions to problems / common tasks I’ve had to deal with which is a good enough reason for their existence. They might even be of use to someone else which can only be a good thing.
strftime jQuery plugin
Currently supports the following specifiers: %a %A %b %B %d %H %y %Y %m %M
if no formatting is given then it will default to ‘%d/%m/%Y’
the contents of the specified element will be set to the resultant formatted date string.
textfilter jQuery plugin
Since contains() has been deprecated with version 1.2 I threw together the following which uses $.grep. I had been using ‘contains()’ for a small routine which narrowed down result rows in a table. In addition to recreating that functionality here I’ve also added an option toggle the case sensitivity – contains was case sensitive.
$(‘tr’).filterText(‘some text here’,'i’)
To restore all the elements in the set:
textinputfeedback jQuery plugin
One drawback of text input fields, especially those with a maxlength, is that unless specified users will not know how many characters are available and how many have been used. The maxlength attribute should be specified especially when the input text will be inserted into a database.