Hi,
I have the following code to display a pop-up div:
<a href="#" id="pop1" rel="div#tt1">Click to show popup</a>
<div class="popupBlock" id="tt1">My popup content ...</div>
The div is initially hidden and with a bit of jQuery code I'm turning it visible when pop1 anchor is clicked. This is the plgin I've made for this:
(function($) {
$.fn.pop = function(options) {
var defaults = {
show: "click",
tooltip: null
};
var options = $.extend(defaults, options);
var target = $(this);
var popup = $(target.attr("rel"));
popup.css("visibility", "hidden").css("display", "none");
target.click(function() {
popup.css("visibility", "visible").css("display", "block");
return false;
});
$('body').click(function() {
popup.css("visibility", "hidden").css("display", "none");
return false;
});
popup.click(function(event) {
event.stopPropagation();
});
};
All seems to be in order, but the whole thing breaks when I add a control in the div, such as:
<div class="popupBlock" id="tt1">My popup content ...
<span> some text here</span>
</div>
The span doesn't trigger the div's click event and hides the div, which I don't want. Anyone has any idea what I need to be doing here to prevent this? Thank you, V