What exactly is this code doing?
- <script type="text/javascript">
- $(document).ready(function() {
- $("*").each(function(e) {
- this.style.color = this.nodeName;
- });
- });
</script>
Basically, when it identifies stuff like <red>Test</red> and the output would be the color red. I am trying to create custom html tags, so that people can type <pink>My test</pink> and their text would come out pink! Its a neat idea, but there are two problems: I don't understand how this code works (it makes no sense to me and i was hoping someone could explain it) and secondly, is there a way that I can make this code pick up on html entities instead? For example:
<pink&rt;My test</pink&rt; - Can this code be modified to pick up on this too? I don't want to comprise security by allowing unsanitized strings to be posted.