Hello,
I have emailed jquery-en about this issue because i didnt know there
is also a jquery-ui mailing list. Nobody in jquery-en seems to be able
to help me so im trying here now.
I am trying to generate a list of items in a html table which has a
delete icon at the end where the user can click. After he clicks a
dialog should appear and the user can confirm or cancel the deletion.
I like to pass the ID of the button to the delete button below of the
dialog so i can take action on this specific row of the table and
reload the page to a specific page or later do some ajax call.
If i do it like i do below then i get "somevar not set" because i
think the dialog function is run before i click the button image. Any
way to solve this?
Carlo
<code>
<style type="text/css" media="all">@import
"/sites/default/modules/jquery_ui/jquery.ui/themes/default/ui.all.css";</style>
<script type="text/javascript" src="/misc/jquery.js"></script>
<script type="text/javascript"
src="/sites/default/modules/jquery_ui/jquery.ui/ui/minified/ui.core.min.js"></script>
<script type="text/javascript"
src="/sites/default/modules/jquery_ui/jquery.ui/ui/minified/ui.dialog.min.js"></script>
<script type="text/javascript"
src="/sites/default/modules/jquery_ui/jquery.ui/ui/minified/ui.draggable.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#dialog").dialog({
autoOpen:false,
modal:true,
overlay: {backgroundColor: "#000",opacity: 0.5},
resizable:false,
buttons:{
"Delete": function() {window.location = "/home/" +
somevar ;},
"Cancel": function() {$(this).dialog("close");}
}
});
$(".button").click(function(){
$("#ui-dialog-title-dialog").text("Attention");
var message = "You are about to do something: ";
$(".ui-dialog-content").text(message + $(this).attr("id"));
var somevar = $(this).attr("id");
$("#dialog").dialog("open");
});
});
</script>
The button is:
<img style="cursor:pointer" class="button" id="REF09624002"
src="images/delete.png" />
Then somewhere at the end of the page I have:
<div id="dialog"></div>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---