Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Add $js->event()

#9

event($type, $content, $options = array())
Bind an event to the current selection. $type can be any of the normal DOM events or a custom event type if your library supports them. $content should contain the function body for the callback. Callbacks will be wrapped with function (event) { ... } unless disabled with the $options.

Options
•wrap - Whether you want the callback wrapped in an anonymous function. (defaults to true)
•stop - Whether you want the event to stopped. (defaults to true)
Example use
$js->get('#some-link'); $js->event('click', $js->alert('hey you!')); If you were using the jQuery library you would get the following Javascript code.

$('#some-link').bind('click', function (event) {

alert('hey you!');
return false;

}); You can remove the return false; by passing setting the stop option to false.

$js->get('#some-link'); $js->event('click', $js->alert('hey you!'), array('stop' => false)); If you were using the jQuery library you would the following Javascript code would be added to the buffer. Note that the default browser event is not cancelled.

$('#some-link').bind('click', function (event) {

alert('hey you!');

});

Reported by Sean Templeton · January 30th, 2010 @ 12:08 AM

State: resolved
Milestone: DojoCake 1.3.2
Assigned to: Sean Templeton Sean Templeton

Activity

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.