$(window).load(function() { var imgDesc = $('.qa-q-view-content img').attr('src'); // console.log(imgDesc); $('head').append('<meta property="og:image" content="' + imgDesc + '">'); });