Ignoring unclosed tags from another <div>?
        Posted  
        
            by Mike
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Mike
        
        
        
        Published on 2010-06-17T06:16:11Z
        Indexed on 
            2010/06/17
            6:33 UTC
        
        
        Read the original article
        Hit count: 312
        
I have a website where members can input text using a limited subset of HTML. When a page is displayed that contains a user's text, if they have any unclosed tags, the formatting "bleeds" across into the next area. For example, if the user entered:
Hi, my name is <b>John
Then, the rest of the page will be bold.
Ideally, there'd be someting I could do that would be this simple:
<div contained>Hi, my name is <b>John</div>
And no tags could bleed out of that div. Assuming there isn't anything this simple, how would I accomplish a similar effect? Or, is there something this easy?
Importantly, I do not want to validate the user's input and return an error if they have unclosed tags, since I want to provide the "easiest" user interface possible for my users.
Thanks!
© Stack Overflow or respective owner