It's writing to innerHTML, so you can embed HTML elements. I justed tested with both
and [b] and it works correctly.
Yes, it is writing as innerHTML, however, it's also writing that inside a <span> tag, as opposed to a <div>. Since a span tag is supposed to be an inline only tag, you can't pass anything inside it that isn't also inline, such as a
tag or a <ul> - both of which is what I would like to do.
Anyone? It would be nice to have HTML inside of the alert.
HTML is allowed inside the alert. I just updated the example to include
tags inside one of the messages and it appropriately split the text onto multiple lines.
Ok, let me rephrase then. The text that you specify to go into the alert gets pushed as innerHTML on a <span> tag. The <span> tag can only contain other inline elements like <abbr>, [b], or
. So, I can't put any block-level html elements, such as
or <ul> inside it.
err... obviously you can, but you don't want to because span isn't supposed to have any block level elements inside it, right?
I've always wondered about that... If you specify display of a span to be block (which is legitimate) are you supposed to treat it as inline or block in terms of allowed nesting elements? Can it still go inside another inline element?
Why not another span with a style to display as block? Or list item?
Well, in terms of valid code, I see your point Joker. However, as this as all generated on the fly, I hardly see the point. If it works, what's the worry?
To answer your question Charles, I don't think that setting display to block changes the rules about what can be placed inside an inline tag. Rather, I think it only affects the actual behavior of the element.
I know this thread is old, but I am running into the same problem with Ext.messageBox. Can someone post code to show this working. <abbr> did not work for me.
A little bit thread-ressurection:
I tested <br /> and it works fine in all 4 major browser, tough it might not comply some HTML standards. I use it only for specific error messages, so I don't mind standards