Anyone know how to make the confirmation dialog appear when i click on the radio buttons.
Downloaded the code from http://projectshadowlight.org/jquery-easy-confirm-dialog/. just bit confused to tweak it.
Below code will trigger the confirmation dialogue before radio button is clicked! if i use the default windows dialogue, it works fine (radio is clicked then pop up)? any solution please!
**HTML:**
<input class="8" id="block_t" name="t_products" onclick="goingnow(this)" type="radio" value="Block x10 (3mins)" rel="3">Block x10 (3mins)
<input class="9" id="block_t" name="t_products" onclick="goingnow(this)" type="radio" value="Block x10 (3mins)" rel="4">Block x10 (6mins)
**javaScript function:**
function goingnow(_this){
if ($("#going_now").attr("value") == 1) {
$("#going_now").attr("value", 0);
} else {
if ($(_this).is(":checked") == true) {
var conf = $(_this).is(":checked").easyconfirm({locale: { title: 'Select Yes or No', button: ['No','Yes']}});
if (conf){
$("#going_now").attr("value",1);
$("#block_mins").attr("value", $(_this).attr("rel"));
} else {
$("#block_mins").attr("value", $(_this).attr("rel"));
}
}
}
}
You can use jQuery Ui dialog to set a confirmation when radio is clicked on. You don't need to use any plugin for this.
var x = "Are you sure you want to take this action";
$('#test').click(function() {
$('<div>' + x + '</div>').dialog({
resizable: false,
buttons: {
"Yes": function() {
alert('action taken') // do something here
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close"); //close confirmation
}
}
});
});