This may be a simple question, but I can't quite get it to work. I'm using a jQuery dialog to display a form loaded from another page on my website. The user clicks on a link, which fires up the dialog. What I'm trying to do is to run a function after loading the HTML into the dialog. Here is my code to load the dialog:
$(document).ready(function () {
$(".openDialog").live("click", function (e) {
e.preventDefault();
$("#dialogBox").dialog({
title: $(this).attr("data-dialog-title"),
close: function() { $(this).remove() },
modal: true
})
.load(this.href);
});
$(".close").live("click", function (e) {
e.preventDefault();
$(this).closest(".dialog").dialog("close");
});
});
I have a function myFunction() that I want to call when the HTML is loaded into the dialog. After looking around for quite a bit, I tried specifying the function in .load, like this:
.load(this.href, myFunction());
I also tried using the open event, like this:
open: myFunction(),
What am I doing wrong?