I have an HTML page with a form and a table, I need to insert information in this small form and show it in the table using only JavaScript, but I'm not getting it.
The JavaScript file is external, as I show in my HTML page below:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Formulario </title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script><scriptsrc="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<br/>
<br/>
<div class="row">
<div class="col-md-12">
<div class="container">
<!-- Formulario -->
<form role="form">
<div class="form-group">
<label for="nome">Nome:</label>
<input type="email" class="form-control" id="nome">
</div>
<div class="form-group">
<label for="sobrenome">Sobrenome:</label>
<input type="text" class="form-control" id="sobrenome">
</div>
<div class="form-group">
<label for="telefone">Telefone:</label>
<input type="text" class="form-control" id="telefone">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form> <!-- /Formulario -->
</div>
</div>
</div>
<br/>
<br/>
<div class="row">
<div class="col-md12">
<div class="container">
<table class="table">
<thead>
<th> Nome: </th>
<th> Sobrenome: </th>
<th> Telefone: </th>
</thead>
<tbody>
<tr>
<td> Bla </td>
<td> Bla </td>
<td> Bla </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script><scriptsrc="js/bootstrap.min.js"></script>
<script src="js/script.js"></script>
</body>
</html>
I would like to put the JavaScript encoding in the script.js file, which is linked in the HTML page.
I have tried to store form information in variable and object array in JavaScript, but at the time of displaying nothing happens.
Does anyone have any idea how to do it?