I want to read an html tag which has formatted text. For example
<p id="strike" onMouseOver="getP()><b>Hello</b></p> // paragraph Tag with formatted text
if i am calling a function,
function getP()
{
var val=document.getElementById('strike').value;
alert(val);
}
am getting undefined in alert, how to get the exact bold formatted text or bold tag with text....Please help me out in this
.textContentreturns the plaintext,.innerHTMLreturns the HTML. There's no way to alert a boldfaced piece of text.belement, and alert that.