So I am using jquery ui dialog like this:
$(document).ready(function() {
// vytvorenie kurzu
$('a.openModalBox').click(function(e) {
var href = $(this).attr('href');
if ('#/' == href) {
e.preventDefault();
$('span.modalBoxContent').dialog({
modal: true,
resizable: false,
title: 'Upozornenie',
zIndex: 1,
show: 'fast',
hide: 'slow',
width: 600,
height: 90,
position: 'middle'
}).width(600);
}
});
});
My HTML looks like this:
<a href="#/" class="next openModalBox lessOpacity">
Go forward
<span class="modalBoxContent">
<p style="font-size: .8em; text-align: center;">
Lorem ipsum.<br />
Lorem ipsum <a href="/index/index" class="accessible-link">lorem ipsum</a>.
</p>
</span>
</a>
And the relevant CSS is:
span.modalBoxContent {
display: none;
}
This works great when there is just a text inside the span.modalBoxContent. but if there is a HTML code, then the span is not completely hidden. In this case (see the above HTML), the link is visible.
How is that possible and how to solve it?
Write valid HTML.
A
spanelement cannot contain apelement. In an attempt to recover from the error, your browser is ending thespanjust before it starts thepand then ignoring the end tag for thespanas another error. (aelements are also inline and also unable to hold block level elements such asp)Your use of placeholder text makes it difficult to tell what the semantics of the content should be, but you probably should be using something more like:
Don’t forget to make the link’s href attribute to point to something sensible.