NAME

Chandra::Event - Event object for element handlers

SYNOPSIS

# In an element handler:
onclick => sub {
    my ($event, $app) = @_;
    
    print "Event type: ", $event->type, "\n";
    print "Target ID: ", $event->target_id, "\n";
    print "Value: ", $event->value, "\n";
}

METHODS

type

The event type (click, change, keyup, submit, etc.)

target_id

The ID attribute of the element that fired the event.

target_name

The name attribute of the element.

value

The current value (for input/select elements).

checked

Boolean checked state (for checkboxes).

key

The key pressed (for keyboard events).

key_code

The numeric key code (for keyboard events).

data($key)

Access custom data passed with the event or data-* attributes.