$(\'.ajax\').click
(
function()
{
// If been bound then we need to return here.
alert(\':D\');
}
)
$(\'.ajax\').click
(
If using jQuery >= 1.7 you can use .on()/.off()
API in conjunction with an event namespace. In this example .off()
is called immediately to ensure previous events (of any kind) with the namespace are un-bound:
$("form")
.off(".validator")
.on("keypress.validator", "input[type='text']", validate);
It's quite a flexible API so you can be very specific if you need to be:
$("form")
.off("keypress.validator", "input[type='text']", validate)
.on("keypress.validator", "input[type='text']", validate);
The docs: http://api.jquery.com/off/