javascript - Place an image next to each dynamic div created -


i creating function dynamic div. function working, want contain 1 same image in front of each innerhtml name. how possible? in advance

function createdivbusiness(returned_data){     var output = document.getelementbyid("business");        (var i=0; i<returned_data.name.length; i++){             var element = document.createelement("div");             element.setattribute("id",'business'+i);             element.setattribute("tabindex","0");             element.setattribute("class","styled-business");             element.innerhtml=returned_data.name[i];             output.appendchild(element);           }     } 

you this

element.innerhtml= "<img src='path_to_image' alt='some text'>" +  returned_data.name[i]; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -