$(top.document).ready(function () {
$(document).click(processAction);
function processAction(e){
var clicked = e.target;
newDialog("You've Clicked On A Link !")
function newDialog(mytitle){
var $dialog = $('<div id="myunique"></div>')
.html("<a href='http://sss.com'>click</a>")
.dialog({
autoOpen: false,
modal: true,
title: mytitle
});
$dialog.dialog('open');
return false
}
});
The problem I am having is that when I click anywhere in the dialog, a new dialog popups, and it seems to produce several of these in a row.
My goal is:
catch all the clicks on page EXCEPT the elements inside the dialog.
your problem is probably here:
this means that any time you click anywhere on your page, the
processAction()method runs!change this so that it only runs when a button or link is clicked and it should solve your problem.
EDIT: according to your edit you want to capture clicks outside your dialog box. Check out this thread for instructions on how to do this.