Skip to content

Commit

Permalink
a few more val examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 27, 2014
1 parent 0f39ea8 commit e4359b0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/Mojo/DOM.pm
Expand Up @@ -846,13 +846,19 @@ This element's type.
my $collection = $dom->val;
Extract values from C<button>, C<input>, C<option>, C<select> and C<textarea>
elements and return a L<Mojo::Collection> object containing these values. In
Extract values from C<button>, C<input>, C<option>, C<select> or C<textarea>
element and return a L<Mojo::Collection> object containing these values. In
the case of C<select>, find all C<option> elements it contains that have a
C<selected> attribute and extract their values.
# "b"
$dom->parse('<form><input name="a" value="b"></form>')->at('input')->val;
$dom->parse('<input name="a" value="b">')->at('input')->val;
# "c"
$dom->parse('<option value="c">C</option>')->at('option')->val;
# "d"
$dom->parse('<option>d</option>')->at('option')->val;
=head2 wrap
Expand Down

0 comments on commit e4359b0

Please sign in to comment.