Jump to content

help with dynamic html


Trolstover

Recommended Posts

Hi , im new to web development stuff. I am trying to add facebook like to my site my code is


var holder=document.createElement("div");holder.setAttribute("class","fb_hoder");  holder.innerHTML += '<div class="fb-like" data-href="images/"'+work[i].src+' data-width="50" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>';inf.appendChild(holder);  

 

this code doesnt work , i think its because of "data-href" and path isn correct , could someone of you please tell me how to write it right? work.src is fine , but im not sure how exactly i should "append" that object value to the data-href. Im not sure about those " ".

 

Thanks for help and answers.

Edited by Trolstover
Link to comment
Share on other sites

Just fill in a value, it's going to look like this:

...data-href="images/"image.jpg data-width=...
So, that double quote isn't in the right place. It needs to look like this:
...data-href="images/image.jpg" data-width=...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...