Adding text from div to another div atribute inside a (stackoverflow problem)

Problem posted: 07/08/2015


Problem description:

The title says it all. The user wanted to fetch the text from the div tag and assign it to the

attribute which had a parent li.

Solution to the problem:

var array=[];
$('.pin_head > div').each(function (index,obj) { 

   array[index]= $(this).text();


$('li > div').each(function (index,obj) {
    var data= $(this).attr("data-col",array[index]);