Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <form method="post" class="formOne">
    <label for="name">Name: <input type="text" id="name"></label>
    <label for="email">Email: <input type="email" id="email"></label>
    <input type="submit">
  </form>
  
  <form method="post" class="formTwo">
    <label for="name">Name: <input type="text" id="name"></label>
    <label for="email">Email: <input type="email" id="email"></label>
    <input type="submit">
  </form>
</body>
</html>
 
let sOne = document.querySelector(
            'input[type=submit]'
          ),
    sTwo = document.querySelectorAll(
            'input[type=submit]'
          )[1];
if (sOne.form.classList.contains('formOne')) {
  console.log('This is form #1');
}
if (sTwo.form.classList.contains('formTwo')) {
  console.log('This is form #2');
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
ImpressiveWebspro
0viewers