Wednesday, June 9, 2010

Jquery : Attaching an event to multiple elements at one go

var a = $("#a");
var b = $("#b");
var combined = a.add(b);

Now u can use

combined.click(function () { /* */ });


this can be used in situation where u want to add same validation to two different forms

No comments: