toolman Posted March 25, 2014 Share Posted March 25, 2014 (edited) 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; Edited March 25, 2014 by toolman Quote 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); Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.