0

Is there a way in Javascript to set a ASP.NET webform to submit to a new window? Simply put, when I click submit or press enter while in the form fields, I want the form to submit in a new window/tab. I thought I could just do jQuery('form').attr('target', '_blank'); but that is ignored, as if ASP.NET is taunting me.

Patrick Szalapski
  • 8,738
  • 11
  • 67
  • 129

1 Answers1

0
<form>
<button type="submit">one</button>
<button type="submit" class="popup">two</button>
</form>

$('.popup').click(function(e) {
    e.preventDefault();
    $(this).closest('form').attr('target', '_blank').submit()
});

I found the answer in this link::

setting target _blank for just one form submit action

Community
  • 1
  • 1
Fermin Pitol
  • 486
  • 5
  • 11
  • preventDefault() doesn't prevent the submission, as it seems ASP.NET webforms circumvents the standard form submission paradigm and disregards target='_blank'. – Patrick Szalapski Jan 24 '14 at 03:01