Talk to people,
I need to get all the href and src values of the tags, link, a, img and script, for this I have developed the following code:
<html>
<script>
$(document).ready(function() {
function execute(){
var conteudo = $('#insert').val();
$('#processado').html(conteudo);
var links = $('#processado a[href],#processado link[href],#processado script[src],#processado img[data-src]');
$.each(links, function(index, item){
var caminho = $(item).attr('href') || $(item).attr('src') || $(item).attr('data-src') || 'Nothing';
caminho = $(item).prop('tagName') + ":" + caminho;
$.parseHTML($('#result').append(caminho + "<br>"));
});
}
$('#execute').click(function(){
execute();
});
});
</script>
<textarea id="insert" style="width:600px; height:80%;"></textarea>
<input id="execute" name="execute" type="submit" value="Execute">
<div id="processado" class="teste" style="display:none;">
</div>
<div id="result"><b>RESULTADO:</b><br>
</div>
The javascript works perfectly, however, when I copy a source code into the text-area and run the script, nothing happens.
Can anyone help me with this?
Right now, very fast.