[RESOLVED]What is the syntax for adding adding spaces and line breaks (<br />) with jquery when adding content dynamically?

Here is the content I am trying to add with a function:

I am adding content dynamically. When I have two <a tags together, even if I use &nbsp; or <br /> the a tags write over each other.
What am I doing wrong?

strAppend = '<div align="center" id="divImg' + i + '" class="slide" >
                                <a class="imgLink" href="#">link 1</a>&nbsp; &nbsp; <a class="imgLink" href="#">link 2</a> <br />
                                <img id="img' + i + '"  src=' + pal[i][1] + ' alt=""  style="width: 1000px"/>

we couldn’t tell you with out knowing the css used.


I have tested the code you posted.

Without the css style ,it worked very well.

You can press F12 ,click the DOM Explorer tab. check the style.

I suggest that you remove the  class="side"  which may has impact on adding the spaces and lines breaks.

Best Regards,

Kevin Shen.

It was that I had the links set with absolute positioning, so margins had no impact and aligning center put them overlapping. Thanks for the effort.

Leave a Reply