Quick tips - Introduction to power of jQuery
Chris Connor 19 November 2009 12:54:48 PM
Decided the best way to demo the power of jQuery was with the simplest piece of code. You have a series of date fields on a web form. On standard (non-xPages) domino there they are represented by a bunch of boring input text fields.
Now give them a class of say ".dateInput".
Now with one piece of code - yes one you can apply a date picker widget to them all
$(".dateInput").datepicker({});
Thats it really simple - a really nice simple date picker that works on all good browsers. The power is the selector bit that allows you to apply functions, events, classes, fancy effects, css (you get the idea - the list goes on) to any series of elements (in this type by class - it could be id, attribute, name etc).
You want to stop people typing in them? Add this
$(".dateInput").attr("readonly",true);
$(".dateInput").css("backgroundColor","#efefef");
What is also great about this is that you can start to organise styling, coding into separate areas to make support and maintenance as easy as possible.
Powerfull stuff and really simple - that's what we like!
- Comments [4]

