Slide 42
Slide 42 text
CONTEXTUAL jQuery Doug Neiner
KEEP YOUR MARKUP CLEAN
$(
document
).on("click",
"a[href$=preview],
a[href$=edit]",
function
(e)
{
e.preventDefault();
var
$this
=
$(this),
parts
=
$this.attr('href').split('/'),
id
=
parts[2],
action
=
parts[3],
author
=
$this.closest("li").find(".author").html();
if
(action
===
"preview")
{
...
}
else
{
...
}
}
);