Sharing new technologies with the community

 
alt

Chris Connor

 
Follow ChrisJConnor on Twitter
Chat with me

Quick tips - Introduction to power of jQuery

Chris Connor  November 19 2009 06:54:48 AM
 
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".

Image:Quick tips - Introduction to power of jQuery

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!

About Me

Notes / Domino consultant with 15 years experience. Focus on XPages, Java / JSF, RCP, jQuery, Dojo, Mobile development to add to traditional Notes / Domino, HTML, CSS and Javascript skills.

My day job is building Web 2.0 Social business applications for my customers. This blog discusses the issues in delivering these modern collaborative solutions.

I am available for hire through my business BSS IT Solutions. We are an IBM Lotus Business Partner based in Scotland serving the UK and beyond!