I have a textarea, inside this textarea, dynamic HTML content are bind like
<div id="HDWebAllTemplateHTMLListMessage">
<div id="header">This is a header</div>
<div class="main">
<div id="content">This is my main content.</div>
<div id="sidebar">This is a sidebar</div>
</div>
<div id="footer">This is my footer</div>
</div>
Somehow i want html content inside .main class. I tried but not able to get html content.
var textAreaContent=$($('#HDWebAllTemplateHTMLListMessage').text());
var divContent=textAreaContent.find('.main');
console.log(divContent.innerHTML);
#HDWebAllTemplateHTMLListMessageis nowhere in the code you posted, nor is.23TC, and what ishtmlContent?#HDWebAllTemplateHTMLListMessage?find()function returns a jQuery object, and it doesn't have a property namedinnerHTML, usehtml()instead. Also, jQuery'stext()function doesn't returns the HTML tags - again, usehtml()instead. See jQuery Docs.