Reputation: 7953
I have some group of check box of which user has to select atleast one and proceed further activity. when the user clicks on a button i check the above functionality if the user has selected one than allow to open a dialog else alert the user to select minimum one and don't open the Dialog.
following is the function to open a dialog.
function openLoadInfo(){
global.getElementById("diaLoad").value="";
global.getElementById("diaReadydate").value="";
global.getElementById("diaCanceldate").value="";
$("#loadinfo")
.dialog(
{
modal: true,
draggable: false,
closeOnEscape: true,
title: "Load # info",
resizable: false,
width: 300,
// open: function() {
//
// },
buttons: {
Ok: function () {
$(this).dialog('close');
}
}
});
through the following script i am able to get value if check box is selected .
$('input:checked').each(function() {
alert("Value : "+$(this).val());
});
if the above code fails than i have to close the dialog and prompt the user to select at least one check box.
Please help me to get this.
Regards
}
Upvotes: 0
Views: 698
Reputation: 705
Now in your case you can write in jQuery
$('input checked').live('click',function(){
if ($(this).is(':checked')) {
diolag.open();
}
else if ($(this).not(':checked')) {
alert("please select mimimum one")
}
});
Upvotes: 2
Reputation: 6207
((yourCondition) ? $(this).dialog( "close" ); $(this).dialog("destroy"); : '');
Upvotes: 2