Objective is to Get individual text segments from HTML file (not a single stream string of whole document.)
I want to scan html files for element tags and text content in between tag pair. I am thinking of doing it something like this :
// var mytags = $('#trans_seg').find('*');
// var total = mytags.length;
//
// for(i = 0; i <= total; i++){
// console.log(mytags[i].textContent);
// }
Its done in console mode of firebug !
I applied this operation in existing HTML file, now how can i do it for other HTML files ?
i have tried somewhat like this:
$(document).ready(function(){
data = '<?php echo mysql_real_escape_string(file_get_contents('test_html.html')); ?>';
tags = data.find('*');
alert($data.length);
});
But it is giving error "TypeError: data.find is not a function".
Do ask me question if it still not clear.
********** Edited *****************
i got this response when i alert data
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div>TODO write content</div>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>