Navigation Menu

Skip to content

Commit

Permalink
a few more val method examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 22, 2015
1 parent 8c4e78a commit 7370e5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Mojo/DOM.pm
Expand Up @@ -950,15 +950,22 @@ elements or return C<undef> if this element has no value. In the case of
C<select>, find C<option> elements with C<selected> attribute and return an
array reference with all values.
# "a"
$dom->parse('<input name="test" value="a">')->at('input')->val;
# "b"
$dom->parse('<input name="a" value="b">')->at('input')->val;
$dom->parse('<textarea>b</textarea>')->at('textarea')->val;
# "c"
$dom->parse('<option value="c">Test</option>')->at('option')->val;
# "d"
$dom->parse('<option>d</option>')->at('option')->val;
# "e"
$dom->parse('<select><option selected>e</option></select>')
->at('select')->val->[0];
=head2 wrap
$dom = $dom->wrap('<div></div>');
Expand Down

0 comments on commit 7370e5a

Please sign in to comment.