I am facing a problem to get the class name from a string in JavaScript.
For example:
var ddd="<p class='Box_title'>Heading text here...</p>";
Now from that I want to get p tag's class name.
Browsers are good in HTML parsing:
//setup
var tmp = document.createElement('div');
tmp.innerHTML = ddd;
// get the class
var class_name = tmp.children[0].className;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With