cheked在复选框上打开一个弹出窗口 [英] Open a popup on check-box cheked
本文介绍了cheked在复选框上打开一个弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想在选中复选框时打开一个弹出窗口,当我们关闭弹出复选框时自动取消选中,还有一件事我想要在弹出窗口中添加一个保存按钮。
我正在使用以下代码。但它没有用。
Hello,
I want to open a popup when a check-box is checked and when we close the popup check-box automatically unchecked and one more thing i want to add a save button in popup.
I am using following code. But it is not working.
$(document).ready(function () {
var the_checkbox = $('#chkBoxHelp');
the_checkbox.click(function () {
if ($(this).is(':checked')) {
$("#txtPopup").dialog({
close: function () {
the_checkbox.prop('checked', false);
}
});
} else {
$("#txtPopup").dialog('close');
}
});
});
并且html如下:
And the html is as below:
<input type="checkbox" id="chkBoxHelp"/>
<div id="txtPopup" style="display: none;">hello! It is a popup</div>
但我不知道为什么这不起作用。
But I don't know why this is not work.
推荐答案
(document).ready(function(){
var the_checkbox =
(document).ready(function () { var the_checkbox =
('#chkBoxHelp');
the_checkbox .click(function(){
if(
('#chkBoxHelp'); the_checkbox.click(function () { if (
(this).is(':checked')){
(this).is(':checked')) {
这篇关于cheked在复选框上打开一个弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文