I am checking for html elements in a string. This works but I have a ton of html elements to check and for various strings. Can this be simplified so I can check all common html element types?
$("<div/>").html(test_string).find('a').each(function (idx, elm) {
//here are your anchors
test_string = "error saving test string. can't contain html elements.";
});
$("<div/>").html(test_string).find('img').each(function (idx, elm) {
test_string = "error saving test string. can't contain html elements.";
});
$("<div/>").html(test_string).find('input').each(function (idx, elm) {
test_string = "error saving test string. can't contain html elements.";
});