toolman Posted March 25, 2014 Share Posted March 25, 2014 Hi, I have the following code which grabs the file name of an image and then displays the result inside a div with an ID However, what I want to do is to display the result in every div on the page with a class of .image. How would I do this? Thanks! var pcode = $('.image img').attr('src').replace(/\.jpg/, '').split('/').slice(-1); document.getElementById('prod').innerHTML += pcode; Link to comment https://forums.phpfreaks.com/topic/287254-display-this-result-for-each/ Share on other sites More sharing options...
mhmazrooei Posted April 14, 2014 Share Posted April 14, 2014 hello toolman. check this code: var pcode = $('.image img').attr('src').replace(/\.jpg/, '').split('/').slice(-1); $('div.image').append(pcode); Link to comment https://forums.phpfreaks.com/topic/287254-display-this-result-for-each/#findComment-1476060 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.