all
I have a HTML input :<h5><font face="times new roman, times, serif" size="7" style="color: #ff9696; ">Sample</font></h5>
<ul> </ul>
I want to extract everything and pass to javascript variables. For example, font name, size, style color. Can I use RegEx?
I have tried this but no use:
<html>
<script>
var input = '<h5><font face="times new roman, times, serif" size="7" style="color: #ff9696; ">Krishanthan</font></h5> <ul> </ul>';
var div = document.createElement('div');
div.innerHTML = input;
var size = div.getElementsByTagName('size')[0];
var text = size.innerText || size.textContent;
alert(text);
</script>
</html>
Please give me some suggestion...
Thanks.
sizeis an attribute of thefontelement, it is not a tag. Get a reference to thefontelement and usegetAttributeto access the attribute.