、これで私は第二ボタンの余分なポップアップを押して、二つの異なるポップアップが持つ空になりたいボタン
// Get the modal
\t \t \t var modal = document.getElementById('myModal');
\t \t \t
\t \t \t // Get the button that opens the modal
\t \t \t var btn = document.getElementById("btn");
\t \t \t var cat = document.getElementById("cat");
\t \t \t // Get the <span> element that closes the modal
\t \t \t var span = document.getElementsByClassName("close")[0];
\t \t \t
\t \t \t // When the user clicks the button, open the modal
\t \t \t btn.onclick = function() {
\t \t \t \t document.getElementById("balance").value = "25";
\t \t \t \t document.getElementById("txt1").value = "+ Rs.125";
\t \t \t \t document.getElementById("txt2").value = "+ Rs.250";
\t \t \t \t document.getElementById("txt3").value = "+ Rs.600";
\t \t \t \t document.getElementById("headerPop").innerHTML = "Add Funds To Your Account";
\t \t \t \t document.getElementById("oopsPop").innerHTML = "";
\t \t \t modal.style.display = "block";
\t \t \t }
// first popup working fine but by pressing the 2nd button will not getting the popup.
// in the 2nd popup you will see current balance and joining amount and also add cash text box.
// if joining amount is less than current balance then it will popup with join button else greater than current balance then calculate remaining amount in add cash text box to equal the joining amount with current balance.
\t \t \t btn1.onclick = function() {
\t \t \t \t $("#oopsPop").append('<div style="display:block; float:left;width:'+170+'px; height:'+50+'px; margin-top:'+5+'px;margin-left:'+5+'px;border:1px dashed #CCCCCC;"> Current Balance <br/> Rs.50 </div> <div style="display:block; float:right;width:'+170+'px; height:'+50+'px; margin-top:'+5+'px;margin-left:'+5+'px;border:1px dashed #CCCCCC;"> Joining Amount <br/> Rs.100 </div> <br/><br/> <p>Add cash to your account to join this contest</p>');
\t \t \t \t document.getElementById("balance").value = "50";
\t \t \t \t document.getElementById("txt1").value = "+ Rs.250";
\t \t \t \t document.getElementById("txt2").value = "+ Rs.500";
\t \t \t \t document.getElementById("txt3").value = "+ Rs.1000";
\t \t \t \t document.getElementById("headerPop").innerHTML = "Oops! Not Enough Cash"; \t \t \t \t
\t \t \t \t modal.style.display = "block";
\t \t \t }
\t \t \t
\t \t \t // When the user clicks on <span> (x), close the modal
\t \t \t span.onclick = function() {
\t \t \t modal.style.display = "none";
\t \t \t }
\t \t \t
\t \t \t // When the user clicks anywhere outside of the modal, close it
\t \t \t window.onclick = function(event) {
\t \t \t if (event.target == modal) {
\t \t \t modal.style.display = "none";
\t \t \t }
\t \t \t }
\t \t \t // Adding Balance.....
\t \t \t function sum(val) {
\t \t \t \t var res = val.value.split(".")
\t \t \t \t console.log('sum '+res[1]);
\t \t \t \t document.getElementById('balance').value = parseInt(document.getElementById('balance').value) +parseInt(res[1]);
\t \t \t \t }
a#btn {
border: 1px solid #303f9f;
color: #303f9f;
cursor: pointer;
float: left;
overflow: hidden;
line-height: .8;
font-size: 1.6em;
margin: 7px 10px 0;
padding: 0 2px 1px;
}
/* The Modal (background) */
.pop {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.pop-content {
position: relative;
background-color: #fefefe;
margin: auto;
text-align: center;
padding: 0;
border: 1px solid #888;
width: 30%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-webkit-animation-name: animatetop;
-webkit-animation-duration: 0.3s;
animation-name: animatetop;
animation-duration: 0.3s
}
/* Add Animation */
@-webkit-keyframes animatetop {
from {top: -300px; opacity:0}
to {top:0; opacity:1}
}
@keyframes animatetop {
from {top: -300px; opacity:0}
to {top:0; opacity:1}
}
/* The Close Button */
.close {
color: white;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.pop-header {
padding: 2px 16px;
background-color: #5cb85c;
color: white;
font-size: 15pt;
}
.pop-body {padding: 2px 16px;}
.pop-footer {
padding: 2px 16px;
background-color: #5cb85c;
color: white;
}
input#balance {
background-color: transparent;
border: none;
border-bottom: 1px solid #9e9e9e;
border-radius: 0;
outline: none;
height: 3rem;
width: 20%;
text-align: center;
margin: 0 0 20px 0;
box-shadow: none;
box-sizing: content-box;
transition: all 0.3s;
font-size: 14px;
padding: 4px;
}
<div class="right">
\t \t <a class="wallet" href="">Rs.<span id="AmountBalance">50</span></a>
\t \t <p>1st</p>
\t \t <button id="btn" title="Add funds">+</button>
\t \t <!-- <button id="btn" title="Add funds">+</button> -->
\t \t \t \t <!-- The Modal -->
\t \t \t \t <div id="myModal" class="pop">
\t \t \t \t
\t \t \t \t <!-- Modal content -->
\t \t \t \t <div class="pop-content">
\t \t \t \t <div class="pop-header">
\t \t \t \t <span class="close">×</span>
\t \t \t \t <div class="sa" id="headerPop">Add Funds To Your Account</div>
\t \t \t \t </div>
\t \t \t \t <div id="extraData" class="pop-body">
\t \t \t \t
\t \t \t \t <div id="oopsPop" style="display: block;">
\t \t \t \t \t </div> \t \t \t \t \t \t \t \t
\t \t \t \t <div >Add Cash</div>
\t \t \t \t \t <div >
\t \t \t \t <div >
\t \t \t \t <span class="Code">Rs.</span>
\t \t \t \t <input type="text" id="balance" value="25" />
\t \t \t \t \t \t \t <div class="">ADD MORE CASH</div></br>
\t \t \t \t <div class="amount">
\t \t \t \t \t \t \t <input type="button" id="txt1" value="+ Rs.125" onClick="sum(this);" />
\t \t \t \t \t \t \t <input type="button" id="txt2" value="+ Rs.250" onClick="sum(this);" />
\t \t \t \t \t \t \t <input type="button" id="txt3" value="+ Rs.600" onClick="sum(this);" />
\t \t \t \t \t \t \t </div></br>
\t \t \t \t \t \t \t <div class="btnRow">
\t \t \t \t \t \t \t \t <input type="submit" id="recharge" name="recharge" class="addMoneySubmit" value="ADD CASH" >
\t \t \t \t \t \t \t </div> </br>
\t \t \t \t </div>
\t \t \t \t </div>
\t \t \t \t
\t \t \t \t
\t \t \t \t </div>
\t \t \t \t
\t \t \t \t </div>
\t \t \t \t
\t \t \t \t </div>
\t \t \t \t
\t \t \t \t
\t \t </div>
\t \t
\t \t
\t \t <br><br><br>
\t \t
\t \t <div class="right">
\t \t \t \t <!-- Trigger/Open The Modal -->
\t \t \t \t <!-- <button id="myBtn">Open Modal</button> -->
\t \t \t \t <p>2nd</p>
\t \t \t \t <button id="btn1" title="Add funds">+</button>
\t \t \t \t <!-- <button id="btn" title="Add funds">join</button> -->
\t
\t \t </div>
は、あなたがhi .....おかげで第二のポップアップにエラー.. – PraveenKumar