how to get the src attribute of an image using javascript code example Example: js get image src var youtubeimgsrc = document.getElementById("youtubeimg").src;