Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

append string in variable using jquery in each loop

var gethtml ='';
$('.nav li').each(function(){
    var img_link = $(this).attr('data-menu');
    gethtml += '<img src="'+img_link+'">';
});
$('.main-img').html(gethtml);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #append #string #variable #jquery #loop
ADD COMMENT
Topic
Name
9+2 =