2
I was trying to make a append or replace in jQuery of an HTML, but I am not succeeding in it. It replaces only one of the <p>
containing the class .frete-gratis
but I wanted to replace them all with a iframe
.
Follow the code I’m trying to make work currently:
var $wrapper = document.querySelector('.frete-gratis'),
// Pega a string do conteúdo atual
HTMLTemporario = $wrapper.innerHTML,
// Novo HTML que será inserido
HTMLNovo = '<iframe allowtransparency="true" src="http://aws.glamour.com.br/quero_bazar/flag-counts/index.html" height="20" width="140"></iframe>';
// Concatena as strings colocando o novoHTML antes do HTMLTemporario
HTMLTemporario = HTMLNovo + HTMLTemporario;
// Coloca a nova string(que é o HTML) no DOM
$wrapper.innerHTML = HTMLTemporario;
Cool man, it worked here very good, but I didn’t understand why the previous code was only picking up the first element set, hahaha more worth even !
– Julio Santos
@Juliosantos, why is explained in Zuul’s reply. ;)
– KaduAmaral