1
Okay, I know there are thousands of ways to do this(better and easier) but I’d just like to make it work. I am passing the images through the JS and would like to assign the link of the same, however, não funciona... The console does not return any error, someone could help ?
window.onload = function(){
rdSocial = $("#social");
var fb = '<img src="img/fb.png" value="1" class="img" onclick="redireciona(this);">';
var twt = '<img src="img/twitter.png" value="2" class="img" onclick="redireciona(this);">';
var insta = '<img src="img/insta.png" value="3" class="img" onclick="redireciona(this);">';
rdSocial.innerHTML += fb;
rdSocial.innerHTML += twt;
rdSocial.innerHTML += insta;
}
function redireciona(obj){
if(obj.value == "1"){
window.location="#";
}
}
I believe the attribution does not work because your social is a Jquery object; if you change
rdSocial.innerHTML += fb;
forrdSocial.html(fb);
or change yourrdSocial = $("#social");
fordocument.getElementbyID('social');
will work....– Rafael Withoeft