jquery easy confirm dialog
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
}
}
});
});
Check working example at http://jsfiddle.net/jZ52e/2/
i have made a plugin that suites your needs. and even more.
I have seen developers facing problems, and this plugin has solved all problems,
Supports: Ajax content loading, Dynamic screen centering on content change, Auto closing of dialogs (runs on timer), Powerpacked with many features.
and its easy to use !
$.alert({
title: 'Its easy to use',
content: 'This is the content', // your content !
content: 'url:form.html', // URL: prefix Loads content from the url (alternatively)
confirm: function(){
alert('The user clicked OK');
}
cancel: function(){
alert('The user clicked cancel');
}
});
Working example and full list of features http://craftpip.github.io/jquery-confirm/
精彩评论