Preciso pegar o valor de um input e enviar para um modal de bootstrap. Fiz um teste mas não sei no que estou errando.
<!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">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Gerador de assinatura</title>
<!-- Bootstrap -->
<link href="dist/css/bootstrap.min.css" rel="stylesheet">
<link href="dist/css/personalizado.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.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<input type="hidden" class="form-control" id="nome-hidden" name="nome-hidden">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<div class="container centralizar">
<div class="row">
<div class="col-md-6 col-md-offset-1">
<div class="input-group">
<span class="input-group-addon" id="sizing-addon2">Nome</span>
<input type="text" name="nome" class="form-control" aria-describedby="sizing-addon2">
</div>
</div>
</div>
<div class="row">
<div class="col-md-2 col-md-offset-1">
<button class="btn btn-lg btn-info btn-block" class="modalAlerta" data-toggle="modal" data-target="#myModal">Gerar</button>
</div>
</div>
</div>
<script>
$('#myModal').on('click', function(){
var nome = $("#nome").val();
$('#sizing-addon2').val(nome);
});
</script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="dist/jquery1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="dist/js/bootstrap.min.js"></script>
</body>
</html>