Jquery点击弹出按钮后如何显示刻度线?
How to show the tick mark after clicking the popup button in Jquery?
在我的“条款和条件”弹出窗口 window 中,我的要求是在关闭弹出窗口后显示勾号。它仅在我们单击复选框时发生。
以下是我的条款和条件代码,
HTML 主页:
<div class="checkout-agreement">
<input type="checkbox" class="required-entry">
<label class="label">
<button type="button" class="action action-show">
<span>I agree the Terms Conditions</span>
</button>
</label>
</div>
弹出window:
<div class="modal-inner-wrap">
<header class="modal-header">
<button class="action-close" data-role="closeBtn" type="button">
<span>Close</span>
</button>
</header>
<div class="modal-content">
<div id="checkout-agreements-modal">
<div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
</div>
<footer class="modal-footer">
<button class="action secondary action-hide-popup" type="button" "><span>Close</span></button>
</footer>
</div>
jQuery代码:
$('.checkout-agreement').modal({
...
closed: function (){
// Do some action when modal closed
}
});
请给我一些建议来完成这项工作。
$(document).ready(function(){
$(document).on("click", ".action-close, .secondary", function(){
$(".termscondchbox").removeAttr("disabled");
$('.termscondchbox').prop('checked', true);
});
$(document).on("click", ".termscondchbox", function(){
$(this).attr("disabled", true);
$(this).prop('checked', false);
});
});
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<div class="checkout-agreement">
<input type="checkbox" class="required-entry termscondchbox" disabled="true">
<label class="label">
<button type="button" class="action action-show">
<span>I agree the Terms Conditions</span>
</button>
</label>
</div>
<div class="modal-inner-wrap">
<header class="modal-header">
<button class="action-close" data-role="closeBtn" type="button">
<span>Close</span>
</button>
</header>
<div class="modal-content">
<div id="checkout-agreements-modal">
<div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
</div>
<footer class="modal-footer">
<button class="action secondary action-hide-popup" type="button" "><span>Close</span></button>
</footer>
</div>
在我的“条款和条件”弹出窗口 window 中,我的要求是在关闭弹出窗口后显示勾号。它仅在我们单击复选框时发生。 以下是我的条款和条件代码,
HTML 主页:
<div class="checkout-agreement">
<input type="checkbox" class="required-entry">
<label class="label">
<button type="button" class="action action-show">
<span>I agree the Terms Conditions</span>
</button>
</label>
</div>
弹出window:
<div class="modal-inner-wrap">
<header class="modal-header">
<button class="action-close" data-role="closeBtn" type="button">
<span>Close</span>
</button>
</header>
<div class="modal-content">
<div id="checkout-agreements-modal">
<div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
</div>
<footer class="modal-footer">
<button class="action secondary action-hide-popup" type="button" "><span>Close</span></button>
</footer>
</div>
jQuery代码:
$('.checkout-agreement').modal({
...
closed: function (){
// Do some action when modal closed
}
});
$(document).ready(function(){
$(document).on("click", ".action-close, .secondary", function(){
$(".termscondchbox").removeAttr("disabled");
$('.termscondchbox').prop('checked', true);
});
$(document).on("click", ".termscondchbox", function(){
$(this).attr("disabled", true);
$(this).prop('checked', false);
});
});
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<div class="checkout-agreement">
<input type="checkbox" class="required-entry termscondchbox" disabled="true">
<label class="label">
<button type="button" class="action action-show">
<span>I agree the Terms Conditions</span>
</button>
</label>
</div>
<div class="modal-inner-wrap">
<header class="modal-header">
<button class="action-close" data-role="closeBtn" type="button">
<span>Close</span>
</button>
</header>
<div class="modal-content">
<div id="checkout-agreements-modal">
<div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
</div>
<footer class="modal-footer">
<button class="action secondary action-hide-popup" type="button" "><span>Close</span></button>
</footer>
</div>