I have a DOM string called innerHTML and I am looking to extract or display the node value using either JavaScript's DOM API or JavaScript RegEx.
"<nobr>
<label class="datatable-header-sortable-child" onmousedown="javascript:giveFeedback('dtl_body_',6,event);" onmouseup="javascript:sortTable('dtl_body_',6,event);">Name<img id="dtl_body_img_6" src="xyz.jpg">
<input id="dtl_body_cmp_6" value="compareCaseInsensitiveStrings" type="hidden">
</label>
</nobr>"
This is my approach. I have a table with cells[i] representing each cell within a for loop, where the condition checks if each cell contains "Name".
if(cells[i].childNodes[0].innerHTML.replace(/(\r\n|\n|\r)/gm ,"").trim() == "Name")
{
/*Do SomeThing */
}
Are there alternative methods to obtain the nodevalue or any recommendations for utilizing RegEx?