unemployment Posted May 31, 2011 Share Posted May 31, 2011 My last childnode is an img and is undefined according to firebug. Can I do this? this.parentNode.parentNode.parentNode.parentNode.previousSibling.childNodes.childNodes.src = "/assets/img/icons/process.png"; Link to comment https://forums.phpfreaks.com/topic/238005-set-src-of-a-childnode/ Share on other sites More sharing options...
.josh Posted June 1, 2011 Share Posted June 1, 2011 Why on earth would you want to refer to something like that? Surely there is a much easier way to target it than that...but can't really say one way or the other w/out some code showing the context. Link to comment https://forums.phpfreaks.com/topic/238005-set-src-of-a-childnode/#findComment-1223608 Share on other sites More sharing options...
unemployment Posted June 2, 2011 Author Share Posted June 2, 2011 Why on earth would you want to refer to something like that? Surely there is a much easier way to target it than that...but can't really say one way or the other w/out some code showing the context. It seems like it's the only way possible when you have var[i].onclick = function() { } because you need to use 'this' since it is dynamic... If there is a better way, please let me know. Link to comment https://forums.phpfreaks.com/topic/238005-set-src-of-a-childnode/#findComment-1224271 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.