I received assistance from a fellow user to customize a popup that turned out great. However, I'm having trouble getting the onclick function to work properly so that the popup only appears when the phone number is clicked. Ideally, I want the phone number to be displayed first, and when clicked, a popup should appear asking the user whether they want to "Call or Text?" This way, the user can choose between calling or texting. Appreciate any help!
var modal = document.getElementById('textCall');
var span = document.getElementById("close");
modal.style.display = "block";
span.onclick = function(){
modal.style.display = "none";
}
CSS
.dialogue {
display: none;
position: fixed;
z-index: 1;
padding-top: 150px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}
#close, #closed {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
#close:hover,
#close:focus,
#closed:focus,
#closed:hover {
color: #000000;
text-decoration: none;
cursor: pointer;
}
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 40%;
}
#textCall {
display: block;
}
HTML
<p onclick="textCall">555-5555</p>
<div id="textCall" class="dialogue">
<div class="modal-content">
<span id="close">×</span>
<h2>Call or Text?</h2>
<a href="tel:15555555555">Call</a>
<a href="sms:15555555555">Text</a>
</div>
</div>
</div>