HTML::Object::DOM::Element::TextArea - HTML Object DOM TextArea Class
use HTML::Object::DOM::Element::TextArea; my $textarea = HTML::Object::DOM::Element::TextArea->new || die( HTML::Object::DOM::Element::TextArea->error, "\n" );
v0.2.0
This interface provides special properties and methods for manipulating the layout and presentation of <textarea> elements.
+-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +--------------------------------------+ | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::TextArea | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +--------------------------------------+
Inherits properties from its parent HTML::Object::DOM::Element
Inherits methods from its parent HTML::Object::DOM::Element
Event listeners for those events can also be found by prepending on before the event type:
on
click event listeners can be set also with onclick method:
click
onclick
$e->onclick(sub{ # do something }); # or as an lvalue method $e->onclick = sub{ # do something };
Fires when the value of an input, select, or textarea element has been changed.
Example:
<input placeholder="Enter some text" name="name"/> <p id="values"></p> my $input = $doc->querySelector('$input'); my $log = $doc->getElementById('values'); $input->addEventListener( input => \&updateValue ); sub updateValue { my $e = shift( @_ ); $log->textContent = $e->target->value; }
See also Mozilla documentation
Under perl, this does not do anything of course, but you can fire yourself the event.
Under JavaScript, this fires when the text selection in a textarea element has been changed.
<div>Enter and select text here:<br><textarea id="mytext" rows="2" cols="20"></textarea></div> <div>selectionStart: <span id="start"></span></div> <div>selectionEnd: <span id="end"></span></div> <div>selectionDirection: <span id="direction"></span></div> my $myinput = $doc->getElementById( 'mytext' ); $myinput->addEventListener( selectionchange => sub { $doc->getElementById( 'start' )->textContent = $mytext->selectionStart; $doc->getElementById( 'end' )->textContent = $mytext->selectionEnd; $doc->getElementById( 'direction' )->textContent = $mytext->selectionDirection; });
Property to handle event of type input. Those events are not automatically fired, but you can trigger them yourself.
input
Property to handle event of type selectionchange. Those events are not automatically fired, but you can trigger them yourself.
selectionchange
Jacques Deguest <jack@deguest.jp>
Mozilla documentation, Mozilla documentation on textarea element
Copyright(c) 2022 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Object
CPAN shell
perl -MCPAN -e shell install HTML::Object
For more information on module installation, please visit the detailed CPAN module installation guide.