1
I own a modal with a radio button
with two options, "Yes and "No". If the answer is "No" then I send an alert on the screen with a message "Sorry, this link is not for you", if the answer is "Yes" I continue redirecting to the desired link. In case I have no idea how to start my Script.
.btn-secondary{
background-color:#4DCC5B !important;
color:white !important;
border-color:#4DCC5B !important;
border-radius: 25px !important;
}
.btn-secondary:hover{
background-color:white !important;
color:#4DCC5B !important;
border-color:#4DCC5B !important;
border-radius: 25px !important;
}
.btn-primary {
background-color:#35c1ba !important;
color:white !important;
border-color:#35c1ba !important;
border-radius: 25px !important;
}
.btn-primary:hover {
background-color:white !important;
color:#35c1ba !important;
border-color:#35c1ba !important;
border-radius: 25px !important;
}
<!doctype html>
<html lang="pt-br">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<link href="css/styles.css?v=0.0.8" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">
<title>Exercicio</title>
</head>
<body>
<!-- Modal -->
<div class="modal fade" id="ExemploModalCentralizado" tabindex="-1" role="dialog" aria-labelledby="TituloModalCentralizado" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="TituloModalCentralizado">Você é seguidor desta pessoa ?</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Fechar">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- Group of material radios - option 1 -->
<div class="form-check">
<input type="radio" class="form-check-input" id="rdModal1" name="resposta" value="Sim">
<label class="form-check-label" for="rdModal1">Sim</label>
</div>
<!-- Group of material radios - option 2 -->
<div class="form-check">
<input type="radio" class="form-check-input" id="rdModal2" name="resposta" value="Nao" checked>
<label class="form-check-label" for="rdModal2">Não</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Sair</button>
<input type="submit" value="Continuar" class="btn btn-primary">
</div>
</div>
</div>
</div>
<!--end modal-->
<div class="container">
<div class="card bg-dark text-white">
<div class="card-img-overlay" id="tour-menu">
<div class="container" id="wrapper-box">
<div class="row no-gutters">
<div class="col-md-6 col-12 mx-auto pt-md-5 pt-0"><a class="botaoModal btn btn-primary btn-block" data-toggle="modal" data-target="#ExemploModalCentralizado" style="cursor: pointer;" role="button" href="https://www.leagueofgraphs.com/pt/">Clique aqui</a></div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="./js/script.js?v=0.0.1"></script>
</body>
</html>
The "Continue" button is of type "Submit" if you have no form?
– Sam
Without too much ado, functional example in fiddle
– Jakson Fischer
I was testing to see if it worked, but there’s really no form. :/
– Artur Freitas