diff --git a/lib/Mojo/DOM.pm b/lib/Mojo/DOM.pm
index 620dae8..fd11fc8 100644
--- a/lib/Mojo/DOM.pm
+++ b/lib/Mojo/DOM.pm
@@ -186,8 +186,10 @@ sub val {
   my $form = {};
   _pair($form, $_->{name}, $_->_val) for $self->find('select, textarea')->each;
   _input($form, $_)
-    for $self->find('input:not([type=button], [type="submit"])')->each;
-  my $e = $self->at('button, input[type=button], input[type=submit]');
+    for $self->find('input:not([type=button], [type=submit], [type="reset"])')
+    ->each;
+  my $e = $self->at(
+    'button[type="submit"], button:not([type]), input[type=submit]');
   _input($form, $e) if $e;
 
   return $form;
diff --git a/t/mojo/dom.t b/t/mojo/dom.t
index 5140088..60f163f 100644
--- a/t/mojo/dom.t
+++ b/t/mojo/dom.t
@@ -2323,36 +2323,47 @@ $dom = Mojo::DOM->new(<<EOF);
   <select name="n"><option>N</option></select>
   <select name="l"><option selected>L</option></select>
   <textarea name="m">M</textarea>
-  <button name="o" value="O">No!</button>
   <input type="button" name="s" value="S" />
+  <button name="o" value="O">No!</button>
   <input type="submit" name="p" value="P" />
 </form>
-<form><input type="submit" name="q" value="Q"></form>
-<form>
-  <input type="button" name="r" value="R">
-  <input type="submit" name="t" value="T">
+<form id="button">
+  <button type="reset" name="r" value="R">No!</button>
+  <button type="button" name="b" value="B">No!</button>
+  <button type="submit" name="s" value="S">Yes!</button>
+</form>
+<form id="input">
+  <input type="button" name="b" value="B">
+  <input type="reset" name="r" value="R">
+  <input type="submit" name="q" value="Q">
 </form>
-<form></form>
+<form id="empty"></form>
 EOF
 is $dom->at('p')->val, undef, 'no value';
 is_deeply $dom->at('form')->val,
-  {a => 'A', f => ['I', 'J'], l => 'L', m => 'M', o => 'O'}, 'right values';
-is $dom->at('input')->val, 'A', 'right value';
-is $dom->find('input')->[2]->val, 'C', 'right value';
-is $dom->find('input')->[3]->val, 'D', 'right value';
-is_deeply $dom->find('select')->first->val, ['I', 'J'], 'right values';
-is $dom->at('select option')->val, 'F', 'right value';
-is $dom->find('select')->[1]->val, undef, 'no value';
-is $dom->find('select')->[1]->at('option')->val, 'N', 'right value';
-is $dom->find('select')->last->val, 'L', 'right value';
-is $dom->at('textarea')->val, 'M', 'right value';
-is $dom->at('form')->find('input')->[-2]->val, 'S', 'right value';
-is $dom->at('form')->find('input')->last->val, 'P', 'right value';
-is_deeply $dom->find('form')->[1]->val, {q => 'Q'}, 'right values';
-is_deeply $dom->find('form')->[2]->val, {}, 'no values';
-is $dom->find('form')->[2]->find('input')->first->val, 'R', 'right value';
-is $dom->find('form')->[2]->find('input')->last->val,  'T', 'right value';
-is_deeply $dom->find('form')->last->val, {}, 'no values';
+  {a => 'A', f => ['I', 'J'], l => 'L', m => 'M', o => 'O'},
+  'val() for form /foo';
+is $dom->at('input')->val, 'A', 'first input val';
+is $dom->find('input')->[2]->val, 'C', 'third input val';
+is $dom->find('input')->[3]->val, 'D', 'fourth input val';
+is_deeply $dom->find('select')->first->val, ['I', 'J'], 'select val';
+is $dom->at('select option')->val, 'F', 'option val';
+is $dom->find('select')->[1]->val, undef, 'no val';
+is $dom->find('select')->[1]->at('option')->val, 'N',
+  'second select option val';
+is $dom->find('select')->last->val, 'L', 'last select val';
+is $dom->at('textarea')->val, 'M', 'textarea val';
+is $dom->at('form')->find('input')->[-2]->val, 'S', 'val for input -2';
+is $dom->at('form')->find('input')->last->val, 'P', 'last input val';
+is_deeply $dom->at('form#button')->val, {s => 'S'},
+  'button button is for javascript';
+is_deeply $dom->at('form#button')->at('[type="button"]')->val, 'B',
+  'val for direct button button';
+is_deeply $dom->at('form#input')->val, {q => 'Q'},
+  'input button is for javascript';
+is_deeply $dom->at('form#input')->at('[type="button"]')->val, 'B',
+  'val for direct input button';
+is_deeply $dom->at('form#empty')->val, {}, 'empty hash for empty form';
 
 # Slash between attributes
 $dom = Mojo::DOM->new('<input /type=checkbox / value="/a/" checked/><br/>');
@@ -2423,4 +2434,4 @@ $dom = Mojo::DOM->new($huge);
 is $dom->all_text, 'works', 'right text';
 is "$dom", $huge, 'right result';