void defaultButton(InputElement textBox, InputElement button) { jQuery.FromElement(textBox).Keyup(delegate(jQueryEvent e) { if (e.Which == 13) { if (AsyncInProgress) return; button.Click(); } }); }