jQuery addClass example

Change class name on click in jQuery

HTML

<form action="https://aoeex.com/datetime.php" target="_blank" id="theForm">
<ul>
    <li><button type="submit" name="which" value="first">First button</button></li>
    <li><button type="submit" name="which" value="second">Second button</button></li>
    <li><button type="submit" name="which" value="third">Third button</button></li>
</ul>
</form>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

li {
  margin: 1em;
}

JavaScript

var $form = $('#theForm');

$form.find('button').click(function(e){
    var target = $(e.target);
    var windowName = target.val();
    window.open('', windowName, 'width=450,height=100,scrollbars,resizable');
    $form.attr('target', windowName);
});