2

Check out this jsfiddle. There is a <div> with a click binding. This div has a child form. Clicking the submit button on the child form fires the parent click event, and does not submit the form.

How can I restore the ability to submit this form? In my real-life application, I also have a file field in the form, which does nothing when it is clicked. I mention that just to avoid any answers like:

$('#myForm input[type=submit]').click(function(){
    $('#myForm').submit();
});

Thanks!

Will
  • 1,893
  • 4
  • 29
  • 42

1 Answers1

4

If you return true from your doSomething method, then it will allow the default action to proceed.

RP Niemeyer
  • 114,592
  • 18
  • 291
  • 211
  • 1
    Thanks, I see that's in the documentation here: http://knockoutjs.com/documentation/click-binding.html#note_3_allowing_the_default_click_action. I read that page twice through, must have just stared right through it! – Will Oct 19 '11 at 14:57
  • Thanks. Found out that KO was the culprit after commenting out large swathes of code :-| – Zephyr was a Friend of Mine Nov 23 '11 at 17:39