Passing data to a jQuery UI Dialog
You could do it like this:
- mark the
<a>
with a class, say "cancel" set up the dialog by acting on all elements with class="cancel":
$('a.cancel').click(function() {
var a = this;
$('#myDialog').dialog({
buttons: {
"Yes": function() {
window.location = a.href;
}
}
});
return false;
});
The key points here are:
- make it as unobtrusive as possible
- if all you need is the URL, you already have it in the href.
Pass parameter to jQuery dialog
Try this out:- http://jsfiddle.net/adiioo7/StMyA/
The above code is working fine on my end.
JS:-
$('#dialogSaveConfirmation').dialog({
autoOpen: false,
modal: true,
width: "auto",
buttons: {
"Save": function () {
var nr = $('#dialogSaveConfirmation').data('param');
alert(nr);
}
}});
$("#dialogSaveConfirmation").data('param', "asdsa").dialog('open');
passing parameters to jquery ui dialog
$("#<%=txtDirProprio.ClientID%>").focus(function()
{
$("#<%=dialog.ClientID%>").data("id","#<%=txtDirProprio.ClientID%>").dialog( "open" );
return false;
});
Have to set the data first before calling .dialog('open');
Related Topics
Fix the Upstream Dependency Conflict Installing Npm Packages
Understanding JavaScript Promise Object
Event.Wheeldelta Returns Undefined
Efficient Way to Insert a Number into a Sorted Array of Numbers
JavaScript Strings Outside of the Bmp
Uncaught Typeerror: Cannot Use 'In' Operator to Search for 'Length' In
Accessing JSON Object Keys Having Spaces
How to Bind to the Change Event of a Textarea in Jquery
How to Invoke "Click" Event Programmatically in D3
How to Load All Files in a Directory Using Webpack Without Require Statements
Why Do People Put Code Like "Throw 1; <Dont Be Evil>" and "For(;;);" in Front of JSON Responses
Splicing a JavaScript Array from Within the Callback Passed to Foreach
Adding Code to a JavaScript Function Programmatically
Getting a Union of Two Arrays in JavaScript
Convert CSV Data into JSON Format Using JavaScript