I need a reliable Javascript library / function to check if a HTML snippet is valid that I can call from my code. For example, it should check that opened tags and quotation
Well, this code:
function tidy(html) { var d = document.createElement('div'); d.innerHTML = html; return d.innerHTML; }
This will "correct" malformed HTML to the best of the browser's ability. If that's helpful to you, it's a lot easier than trying to validate HTML.