I have a link, which is rendered via the l function. It's a link which calls a function that deletes a node. Before the function is called, I want an alert box to pop up and give the user the option to 'Cancel' or 'Confirm'. Adding this as an argument to the l function works:
array('attributes' => array('onclick' => 'return confirm("Are you sure?")'))
...but is there an existing function, or something, that does a nicer job?
I'd rather not add a contrib module for such a small task.